From patchwork Sat Jul 21 16:08:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 947395 X-Patchwork-Delegate: boris.brezillon@free-electrons.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=osadl.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="B1TKIPld"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41Xt8Q6G7jz9s4Z for ; Sun, 22 Jul 2018 02:13:10 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=SH89qbad527EKSF58h/suTM3OBurwBJGyFQpYvAX17c=; b=B1T KIPldPy7zqCbn0juvjZA8CNTl8hu+T+Be7Q5p0sMZ23pdhtid0dKX8nEUYaf6F/74vT4UvxdtuKpi t6clewfy9ygHYxT11Av6ke7j8Y+rw/T5ZTjWDHaJvncKJpW8Heg2lwNunkSwXI/KEA617bLehZ9qE lFHEk7gIUc53yYB3O4AugKG3SvxVlKQ/naAgh1wUbbslBg5Up/LFEng8Ex+lY0vAWg6wq8XZYHEIW 4Z8UP0sd2orP75Qx+B3QauhH2Kmi/TNAIh4TKwWGA9pF9rrovsjT2FU0INpdODswHf+4ttjIcl27F nSC/0rI43f5kjFy2RslzzO04etaBh+g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fguVC-0005BZ-CV; Sat, 21 Jul 2018 16:13:02 +0000 Received: from www.osadl.org ([62.245.132.105]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fguV9-0005Aq-7e for linux-mtd@lists.infradead.org; Sat, 21 Jul 2018 16:13:01 +0000 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59] (may be forged)) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id w6LG9H8Z031732; Sat, 21 Jul 2018 18:09:17 +0200 From: Nicholas Mc Guire To: Graham Moore Subject: [PATCH] mtd: spi-nor: cadence-quadspi: make return type fit wait_for_completion_timeout Date: Sat, 21 Jul 2018 18:08:13 +0200 Message-Id: <1532189293-5975-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-Spam-Status: No, score=-1.9 required=6.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180721_091259_589296_4EC3E744 X-CRM114-Status: GOOD ( 11.52 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [62.245.132.105 listed in list.dnswl.org] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vignesh R , Boris Brezillon , Richard Weinberger , linux-kernel@vger.kernel.org, Marek Vasut , linux-mtd@lists.infradead.org, Nicholas Mc Guire , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org wait_for_completion_timeout returns an unsigned long not int. declare a suitably type timeout and fix up assignment and check. Signed-off-by: Nicholas Mc Guire Reported-by: Vignesh R Fixes: 140623410536 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller") Signed-off-by: Nicholas Mc Guire Signed-off-by: Boris Brezillon --- Given that CQSPI_TIMEOUT_MS is < INT_MAX the type conversion is actually safe here but it is cleaner to use proper types. Patch was compile tested with: socfpga_defconfig (implies CONFIG_SPI_CADENCE_QUADSPI=y) Patch is against 4.18-rc5 (localversion-next is next-20180720) drivers/mtd/spi-nor/cadence-quadspi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c index d7e10b3..ce5f840 100644 --- a/drivers/mtd/spi-nor/cadence-quadspi.c +++ b/drivers/mtd/spi-nor/cadence-quadspi.c @@ -622,6 +622,7 @@ static int cqspi_indirect_write_execute(struct spi_nor *nor, loff_t to_addr, unsigned int remaining = n_tx; unsigned int write_bytes; int ret; + unsigned long timeout; writel(to_addr, reg_base + CQSPI_REG_INDIRECTWRSTARTADDR); writel(remaining, reg_base + CQSPI_REG_INDIRECTWRBYTES); @@ -649,10 +650,10 @@ static int cqspi_indirect_write_execute(struct spi_nor *nor, loff_t to_addr, iowrite32_rep(cqspi->ahb_base, txbuf, DIV_ROUND_UP(write_bytes, 4)); - ret = wait_for_completion_timeout(&cqspi->transfer_complete, - msecs_to_jiffies - (CQSPI_TIMEOUT_MS)); - if (!ret) { + timeout = wait_for_completion_timeout(&cqspi->transfer_complete, + msecs_to_jiffies + (CQSPI_TIMEOUT_MS)); + if (!timeout) { dev_err(nor->dev, "Indirect write timeout\n"); ret = -ETIMEDOUT; goto failwr;