Commit 420c4495 authored by Tudor Ambarus's avatar Tudor Ambarus Committed by Miquel Raynal

mtd: spi-nor: spansion: make sure local struct does not contain garbage

Following errors were seen with um-x86_64-gcc12/um-allyesconfig:
+ /kisskb/src/drivers/mtd/spi-nor/spansion.c: error: 'op' is used uninitialized [-Werror=uninitialized]:  => 495:27, 364:27

Initialise local struct spi_mem_op with all zeros at declaration in
order to avoid using garbage data for fields that are not explicitly
set afterwards.
Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Fixes: c87c9b11 ("mtd: spi-nor: spansion: Determine current address mode")
Fixes: 6afcc840 ("mtd: spi-nor: spansion: Add support for Infineon S25FS256T")
Signed-off-by: default avatarTudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20230509193900.948753-1-tudor.ambarus@linaro.org
parent 44c026a7
...@@ -361,7 +361,7 @@ static int cypress_nor_determine_addr_mode_by_sr1(struct spi_nor *nor, ...@@ -361,7 +361,7 @@ static int cypress_nor_determine_addr_mode_by_sr1(struct spi_nor *nor,
*/ */
static int cypress_nor_set_addr_mode_nbytes(struct spi_nor *nor) static int cypress_nor_set_addr_mode_nbytes(struct spi_nor *nor)
{ {
struct spi_mem_op op; struct spi_mem_op op = {};
u8 addr_mode; u8 addr_mode;
int ret; int ret;
...@@ -492,7 +492,7 @@ s25fs256t_post_bfpt_fixup(struct spi_nor *nor, ...@@ -492,7 +492,7 @@ s25fs256t_post_bfpt_fixup(struct spi_nor *nor,
const struct sfdp_parameter_header *bfpt_header, const struct sfdp_parameter_header *bfpt_header,
const struct sfdp_bfpt *bfpt) const struct sfdp_bfpt *bfpt)
{ {
struct spi_mem_op op; struct spi_mem_op op = {};
int ret; int ret;
ret = cypress_nor_set_addr_mode_nbytes(nor); ret = cypress_nor_set_addr_mode_nbytes(nor);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment