From patchwork Thu Sep 14 11:06:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 112535 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp610774qgf; Thu, 14 Sep 2017 04:08:13 -0700 (PDT) X-Google-Smtp-Source: ADKCNb55SiPXh0bhUB7xqzkfdvuw1UitYadlvOdpGuPWeacq+FcKPWzaQHyPq41BciEACWpSnRxu X-Received: by 10.98.68.206 with SMTP id m75mr21472610pfi.163.1505387293437; Thu, 14 Sep 2017 04:08:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505387293; cv=none; d=google.com; s=arc-20160816; b=zNelUOAVROn0syOPDeCEtJrfSWrsX8Ip0EyxAjafrKpl1/bNp64YuANYqwtU4X/v72 FKAxdOw4kGJuWxc9D0FRqBQ9WMNsdTA/O/KyjHOQcQLMaaEDKPGexxjVclrbBurvQb4J iftDOScFEQwMr4McwJwn5T9R8VBUg19sBJVBXMWg9VTCNRDpWfw2r0WsI49ZA80XW+/P P7+c8mtFfHdgMEmm4AToEV7InAf/zB6DIp4TsX/ySKY4VfTVjXuLnCEweRF0a7mCNUU0 WEJid+lra2/S5UcxrNO8yF8GXUt+9XSKl1atbkAqvieGowVaqzpC0zuJKGhWkZM80BUs OtgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :dkim-signature:arc-authentication-results; bh=lohjy8WvJuuDWPy2N3VQ0Qo/ILECLuT5CqutwIIy71A=; b=owb8U4hl8nYUJZ1/GrrOiB7bd8Ua8ITpoddpJUBGaFQBNwIKHRqtWDzejFFssNk7XC RmigRwvVzMOiD9osorvL0PKb0TJWwhw4maVuCqPYpIgadZgYSlYO5DNZ5O+uR9uzMGfx yTKnUr1UtHJCleeB1x4mn/j7KhuSptPk5KM4GisHx8nE7fVFPzN29X4qMrWQxYWBrSjX YmkA2afqJF8LJ3DVo8Mvm2zjvy+di6OVpC7y/UHEk+9TlI2C00tck1Eid3zec4LXJ+Bi EqEwp9LabktGcYKSlX6zwlH68t01rL2ey9lNWGHeWahYvQemxTQOGUMwp+jGWn5zWjs+ YcJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=u9QvOy5/; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id m3si12265762pld.779.2017.09.14.04.08.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Sep 2017 04:08:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=u9QvOy5/; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=lohjy8WvJuuDWPy2N3VQ0Qo/ILECLuT5CqutwIIy71A=; b=u9QvOy5/ExQZBJ LBVVgW+18Z06GXYwLHLc0QeSmgn0lmWve2D19fSekbdvfTbO4cirHeOfCEQcZts30g3FQC4P2y06c /Mly7aFNI1OmSjeWjzU4Zz+DiU1fRD8i73ASjgLHYIMpTYFmv0H46+hVb8mA+SHV9lJXOZMMfIW1c nTlYAPsnQObhhhJClGRHWaMmnjz4EQCwBszocp1JLQ3CQAqGDYVbWNpNhnmhUGKcpc75Ujfbwn5FC x77h7ieQA3Kw832NGZ5bwMtwRNMN3lAEaiVOuQj3ilqY7LRkXzGF4OCv9vUhmW7So+TTMxmogJzVG x8scAHUwM/WQYH6hylXQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dsS04-0000JN-Mv; Thu, 14 Sep 2017 11:08:04 +0000 Received: from mout.kundenserver.de ([217.72.192.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dsRzh-0008Rs-Gd; Thu, 14 Sep 2017 11:07:44 +0000 Received: from wuerfel.lan ([95.208.190.237]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0M8zxV-1dio0L1MSL-00CNQw; Thu, 14 Sep 2017 13:07:12 +0200 From: Arnd Bergmann To: Cyrille Pitchen , Marek Vasut Subject: [PATCH] mtd: spi-nor: stm32-quadspi: avoid unintialized return code Date: Thu, 14 Sep 2017 13:06:59 +0200 Message-Id: <20170914110709.3591691-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 X-Provags-ID: V03:K0:E8JqzB6AzgYnMvatpFTscg0rtb0LaZ1CTbyabfEhWsygsvbUk1s QPti6WnPk6Imy6vRXizNsfpgxVl3C816jKSQ1lNkvsRqEkXU8KGII559ugcFMRF3CZ9uZ/2 E86g7r980kJwj0nK7ILSfhwgsw0+XasADv6zUXVKr1Z4VjyZZACEOqiErTQL3ZVb3SVyKgk 6y+Qs6U90nOVsvdArir4A== X-UI-Out-Filterresults: notjunk:1; V01:K0:xp3DOooirCo=:4jNWEtnyEMQQhPLOug1VLW 5J9ITGFZE2GBVQO6BnZoLxjKHhTIrxR+daZ34qpUDU4bC4/Dmu3TJqUfuAgyllwesag2Vonao iafoRhV+girQ8qUt6iZ905A63TIkrL+Ra3dvFeOuG69jB6ogHhzDeEt7ZAAWHqCQbSUMiUoQt BLVuLx8eBitM/6+S53Fom3qwn3YiPUjuEHXQ8yoj6WjT88gqeb45hmO7JjChcWjJfk2V6Rgfh ZBIDqJkn3MT3yozCflHWcFyvF3JxwMiCMDFPil++0Bzll6q2yhLawUBXPvKIJQ6jGrsn+Scza Pse3ik7pSK8hcqhbd3qgZO8bKI2sVVei0jxz/HtR/nANhQA0PR+TQgQ0PVmakWC/tk47muU7Q Xx6OXVT3QNByI0F+Jj1sUM/9JbI0pjngT3q+pVeddYtAro+Oe7dF2BMV8yDEyKCMGQhWh75e7 CVyA2Bgg77Axw9aW5MRisWT758iUiNyDxBVnCmxpU/YY8x4gnjxgvEpeWPw6JG1Nt2udWfOCC lCOoW8aOiwyG4BrGXJAzve2RnKHTIiPb0LiF10/waE4JvF3jkf7qKghsW+SJf1YpN+YYs4jsw 6IMgb27fpRqYk6Aedz9Go9jk/Pvd3geqWoXIqLqWqTkkRHlwEqbDt+B2+ZeeXdj663gncnZdN Ku7BoPEvKoRiaZ/kj5fCdMYsAbS3cUe9AyIM+dWUm0FJhsa6AjO+ffmuY7c7E5gbq3hsKYS7P BorTRAaP+N9gvJpa9ZGpV7FtRBpVs6tUcXLwVbd8KdY+/YlGjt9la1ychso= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170914_040741_889367_7ED0D7B5 X-CRM114-Status: GOOD ( 11.04 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.5 RCVD_IN_SORBS_SPAM RBL: SORBS: sender is a spam source [217.72.192.74 listed in dnsbl.sorbs.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [217.72.192.74 listed in list.dnswl.org] -2.8 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [217.72.192.74 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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: Boris Brezillon , Alexandre Torgue , Arnd Bergmann , Richard Weinberger , linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Maxime Coquelin , Brian Norris , David Woodhouse , Ludovic Barre Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org If we send zero-length data to stm32_qspi_tx_poll() on older compiler versions such as gcc-4.6, we get warned that the return code is uninitialized: drivers/mtd/spi-nor/stm32-quadspi.c:248:2: error: ‘ret’ may be used uninitialized in this function [-Werror=uninitialized] On newer compiler versions, the return code is always zero in this case, as the local variable gets optimized away and is assumed to be zero after the loop completes without error. This changes the function to instead return -EINVAL if it ever gets called with a zero length buffer. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82203 Signed-off-by: Arnd Bergmann --- drivers/mtd/spi-nor/stm32-quadspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c index 86c0931543c5..711cfe7aa4bf 100644 --- a/drivers/mtd/spi-nor/stm32-quadspi.c +++ b/drivers/mtd/spi-nor/stm32-quadspi.c @@ -227,7 +227,7 @@ static int stm32_qspi_tx_poll(struct stm32_qspi *qspi, void (*tx_fifo)(u8 *, void __iomem *); u32 len = cmd->len, sr; u8 *buf = cmd->buf; - int ret; + int ret = -EINVAL; if (cmd->qspimode == CCR_FMODE_INDW) tx_fifo = stm32_qspi_write_fifo;