linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: rawnand: placate "$VARIABLE is used uninitialized" warnings
@ 2022-10-24  9:20 Adam Borowski
  2022-11-07 16:20 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: Adam Borowski @ 2022-10-24  9:20 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, linux-mtd
  Cc: Adam Borowski

The compiler is not smart enough to notice that it's impossible for
them to be actually used uninitialized.  Which exact variables trip
here varies depending on random surrounding code; none triggered in
6.1-rc1 but 6.1-rc2 fails on three of these five, despite variables
declared in the very same line having identical flow.

Signed-off-by: Adam Borowski <kilobyte@angband.pl>
---
 drivers/mtd/nand/raw/nand_base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 33f2c98a030e..c3cc66039925 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -5834,7 +5834,7 @@ nand_match_ecc_req(struct nand_chip *chip,
 	int req_step = requirements->step_size;
 	int req_strength = requirements->strength;
 	int req_corr, step_size, strength, nsteps, ecc_bytes, ecc_bytes_total;
-	int best_step, best_strength, best_ecc_bytes;
+	int best_step = 0, best_strength = 0, best_ecc_bytes = 0;
 	int best_ecc_bytes_total = INT_MAX;
 	int i, j;
 
@@ -5915,7 +5915,7 @@ nand_maximize_ecc(struct nand_chip *chip,
 	int step_size, strength, nsteps, ecc_bytes, corr;
 	int best_corr = 0;
 	int best_step = 0;
-	int best_strength, best_ecc_bytes;
+	int best_strength = 0, best_ecc_bytes = 0;
 	int i, j;
 
 	for (i = 0; i < caps->nstepinfos; i++) {
-- 
2.37.2.609.g9ff673ca1a


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtd: rawnand: placate "$VARIABLE is used uninitialized" warnings
  2022-10-24  9:20 [PATCH] mtd: rawnand: placate "$VARIABLE is used uninitialized" warnings Adam Borowski
@ 2022-11-07 16:20 ` Miquel Raynal
  0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2022-11-07 16:20 UTC (permalink / raw)
  To: Adam Borowski, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, linux-mtd

On Mon, 2022-10-24 at 09:20:26 UTC, Adam Borowski wrote:
> The compiler is not smart enough to notice that it's impossible for
> them to be actually used uninitialized.  Which exact variables trip
> here varies depending on random surrounding code; none triggered in
> 6.1-rc1 but 6.1-rc2 fails on three of these five, despite variables
> declared in the very same line having identical flow.
> 
> Signed-off-by: Adam Borowski <kilobyte@angband.pl>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-07 16:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24  9:20 [PATCH] mtd: rawnand: placate "$VARIABLE is used uninitialized" warnings Adam Borowski
2022-11-07 16:20 ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).