From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752225AbdJ3IGO (ORCPT ); Mon, 30 Oct 2017 04:06:14 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:40851 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751269AbdJ3IGM (ORCPT ); Mon, 30 Oct 2017 04:06:12 -0400 Subject: Re: [PATCH v2 1/3] mtd: spi-nor: stm32-quadspi: Fix uninitialized error return code To: Cyrille Pitchen , Marek Vasut CC: David Woodhouse , Brian Norris , Boris Brezillon , Richard Weinberger , Alexandre Torgue , Rob Herring , , , , , Geert Uytterhoeven References: <1509030755-19044-1-git-send-email-ludovic.Barre@st.com> <1509030755-19044-2-git-send-email-ludovic.Barre@st.com> From: Ludovic BARRE Message-ID: <3dc4ff33-77a3-be2e-c20f-675b800dca2c@st.com> Date: Mon, 30 Oct 2017 09:05:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG8NODE3.st.com (10.75.127.24) To SFHDAG6NODE1.st.com (10.75.127.16) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-30_02:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org thanks Cyrille indeed, the "Signed-off" on Geert'commit was a mistake BR Ludo On 10/29/2017 06:50 PM, Cyrille Pitchen wrote: > Hi Ludovic, > > Le 26/10/2017 à 17:12, Ludovic Barre a écrit : >> From: Geert Uytterhoeven >> >> With gcc 4.1.2: >> >> drivers/mtd/spi-nor/stm32-quadspi.c: In function ‘stm32_qspi_tx_poll’: >> drivers/mtd/spi-nor/stm32-quadspi.c:230: warning: ‘ret’ may be used uninitialized in this function >> >> Indeed, if stm32_qspi_cmd.len is zero, ret will be uninitialized. >> This length is passed from outside the driver using the >> spi_nor.{read,write}{,_reg}() callbacks. >> >> Several functions in drivers/mtd/spi-nor/spi-nor.c (e.g. write_enable(), >> write_disable(), and erase_chip()) call spi_nor.write_reg() with a zero >> length. >> >> Fix this by returning an explicit zero on success. >> >> Fixes: 0d43d7ab277a048c ("mtd: spi-nor: add driver for STM32 quad spi flash controller") >> Signed-off-by: Geert Uytterhoeven >> Acked-by: Ludovic Barre >> Signed-off-by: Ludovic Barre > I removed your "Signed-off" because I think this is a mistake but kept > your "Acked-by" tag. > > Applied to the spi-nor/next branch of l2-mtd. > > Thanks! > >> --- >> drivers/mtd/spi-nor/stm32-quadspi.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c >> index 86c0931..ad6a3e1 100644 >> --- a/drivers/mtd/spi-nor/stm32-quadspi.c >> +++ b/drivers/mtd/spi-nor/stm32-quadspi.c >> @@ -240,12 +240,12 @@ static int stm32_qspi_tx_poll(struct stm32_qspi *qspi, >> STM32_QSPI_FIFO_TIMEOUT_US); >> if (ret) { >> dev_err(qspi->dev, "fifo timeout (stat:%#x)\n", sr); >> - break; >> + return ret; >> } >> tx_fifo(buf++, qspi->io_base + QUADSPI_DR); >> } >> >> - return ret; >> + return 0; >> } >> >> static int stm32_qspi_tx_mm(struct stm32_qspi *qspi, >> >