mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: miquel.raynal@bootlin.com
Cc: pratyush@kernel.org, michael@walle.cc, richard@nod.at,
	vigneshr@ti.com, Takahiro.Kuwano@infineon.com,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	geert@linux-m68k.org
Subject: Re: [PATCH 2/2] mtd: spi-nor: spansion: make sure local struct does not contain garbage
Date: Tue, 9 May 2023 20:30:04 +0100	[thread overview]
Message-ID: <29a5762d-ecf8-948c-2892-58ff3349ada3@linaro.org> (raw)
In-Reply-To: <20230509192506.947094-2-tudor.ambarus@linaro.org>



On 5/9/23 20:25, Tudor Ambarus wrote:
> Following error was 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
> 
> Set the spi_mem_op fields at the time of declaration so that all
> uninitialized members be initialized to default value.
> 
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Fixes: 6afcc84080c41 ("mtd: spi-nor: spansion: Add support for Infineon S25FS256T")
> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> ---
>  drivers/mtd/spi-nor/spansion.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c
> index d44ffaac1dba..257d05ed4146 100644
> --- a/drivers/mtd/spi-nor/spansion.c
> +++ b/drivers/mtd/spi-nor/spansion.c
> @@ -492,7 +492,10 @@ s25fs256t_post_bfpt_fixup(struct spi_nor *nor,
>  			  const struct sfdp_parameter_header *bfpt_header,
>  			  const struct sfdp_bfpt *bfpt)
>  {
> -	struct spi_mem_op op;
> +	struct spi_mem_op op =
> +		CYPRESS_NOR_RD_ANY_REG_OP(nor->params->addr_mode_nbytes,
> +					  SPINOR_REG_CYPRESS_ARCFN, 1,
> +					  nor->bouncebuf);
>  	int ret;
>  

oops, this is wrong as addr_mode_nbytes is updated just below in
cypress_nor_set_addr_mode_nbytes(), so the fix is to init op with {} at
declaration, as in the previous patch.

>  	ret = cypress_nor_set_addr_mode_nbytes(nor);
> @@ -500,10 +503,6 @@ s25fs256t_post_bfpt_fixup(struct spi_nor *nor,
>  		return ret;
>  
>  	/* Read Architecture Configuration Register (ARCFN) */
> -	op = (struct spi_mem_op)
> -		CYPRESS_NOR_RD_ANY_REG_OP(nor->params->addr_mode_nbytes,
> -					  SPINOR_REG_CYPRESS_ARCFN, 1,
> -					  nor->bouncebuf);
>  	ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto);
>  	if (ret)
>  		return ret;

  reply	other threads:[~2023-05-09 19:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-07 21:18 Linux 6.4-rc1 Linus Torvalds
2023-05-08 11:57 ` Build regressions/improvements in v6.4-rc1 Geert Uytterhoeven
2023-05-08 12:14   ` Geert Uytterhoeven
2023-05-08 15:19     ` Pratyush Yadav
2023-05-08 15:32       ` Geert Uytterhoeven
2023-05-08 15:46       ` Raghavendra, Vignesh
2023-05-09 19:25     ` [PATCH 1/2] mtd: spi-nor: spansion: make sure local struct does not contain garbage Tudor Ambarus
2023-05-09 19:25       ` [PATCH 2/2] " Tudor Ambarus
2023-05-09 19:30         ` Tudor Ambarus [this message]
2023-05-09 19:39     ` [PATCH v2] " Tudor Ambarus
2023-05-17  7:17       ` Tudor Ambarus
2023-05-22 15:58       ` Miquel Raynal
2023-05-08 20:34 ` Linux 6.4-rc1 Guenter Roeck
2023-05-10  4:31 ` linux-next stats (Was: Linux 6.4-rc1) Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29a5762d-ecf8-948c-2892-58ff3349ada3@linaro.org \
    --to=tudor.ambarus@linaro.org \
    --cc=Takahiro.Kuwano@infineon.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=michael@walle.cc \
    --cc=miquel.raynal@bootlin.com \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®