WSL2-Linux-Kernel/drivers/mtd/spi-nor
Geert Uytterhoeven 000a335b2d mtd: spi-nor: stm32-quadspi: Fix uninitialized error return code
[ Upstream commit 05521bd3d1 ]

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: 0d43d7ab27 ("mtd: spi-nor: add driver for STM32 quad spi flash controller")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Ludovic Barre <ludovic.barre@st.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-20 10:10:30 +01:00
..
Kconfig mtd: spi-nor: intel-spi: Add support for Intel Denverton SPI serial flash controller 2017-08-01 19:19:28 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
aspeed-smc.c mtd: spi-nor: aspeed: set 4B setting for all chips 2017-08-14 17:23:50 +02:00
atmel-quadspi.c mtd: atmel-quadspi: Remove unneeded pinctrl header 2017-08-01 21:23:21 +02:00
cadence-quadspi.c mtd: spi-nor: cqspi: remove duplicate const 2017-06-27 21:28:52 +02:00
fsl-quadspi.c mtd: spi-nor: introduce SPI 1-2-2 and SPI 1-4-4 protocols 2017-05-15 21:56:17 +02:00
hisi-sfc.c mtd: Convert to using %pOF instead of full_name 2017-08-15 14:00:43 +02:00
intel-spi-pci.c mtd: spi-nor: intel-spi: Add support for Intel Denverton SPI serial flash controller 2017-08-01 19:19:28 +02:00
intel-spi-platform.c
intel-spi.c spi-nor: intel-spi: Fix broken software sequencing codes 2017-11-30 08:40:55 +00:00
intel-spi.h
mtk-quadspi.c mtd: mtk-quadspi: Remove unneeded pinctrl header 2017-08-01 21:24:47 +02:00
nxp-spifi.c mtd: spi-nor: introduce SPI 1-2-2 and SPI 1-4-4 protocols 2017-05-15 21:56:17 +02:00
spi-nor.c mtd: spi-nor: fix DMA unsafe buffer issue in spi_nor_read_sfdp() 2017-09-18 09:53:27 +02:00
stm32-quadspi.c mtd: spi-nor: stm32-quadspi: Fix uninitialized error return code 2017-12-20 10:10:30 +01:00