diff mbox series

[1/1] mtd: rawnand: cortina_nand: missing initialization

Message ID 20210220094250.3291-1-xypron.glpk@gmx.de
State Accepted
Commit 6b0431dc21050a14bf80db4b3c34444816d7652d
Delegated to: Tom Rini
Headers show
Series [1/1] mtd: rawnand: cortina_nand: missing initialization | expand

Commit Message

Heinrich Schuchardt Feb. 20, 2021, 9:42 a.m. UTC
ca_do_bch_correction() takes a random value from the stack and starts
counting bitflips from this value. Initialize the counter.

This passed unnoticed as the value is finally ignored in the call
hierarchy.

Fixes: 161df94b3c43 ("mtd: rawnand: cortina_nand: Add Cortina CAxxxx SoC support")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/mtd/nand/raw/cortina_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.30.0

Comments

Tom Rini Feb. 25, 2021, 1:31 p.m. UTC | #1
On Sat, Feb 20, 2021 at 10:42:50AM +0100, Heinrich Schuchardt wrote:

> ca_do_bch_correction() takes a random value from the stack and starts
> counting bitflips from this value. Initialize the counter.
> 
> This passed unnoticed as the value is finally ignored in the call
> hierarchy.
> 
> Fixes: 161df94b3c43 ("mtd: rawnand: cortina_nand: Add Cortina CAxxxx SoC support")
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/cortina_nand.c b/drivers/mtd/nand/raw/cortina_nand.c
index 12bd1ded83..81fa8788a4 100644
--- a/drivers/mtd/nand/raw/cortina_nand.c
+++ b/drivers/mtd/nand/raw/cortina_nand.c
@@ -546,7 +546,7 @@  static int ca_do_bch_correction(struct nand_chip *chip,
 	struct nand_drv *info =
 	    (struct nand_drv *)nand_get_controller_data(chip);
 	unsigned int reg_v, err_loc0, err_loc1;
-	int k, max_bitflips;
+	int k, max_bitflips = 0;

 	for (k = 0; k < (err_num + 1) / 2; k++) {
 		reg_v = readl(&info->reg->flash_nf_bch_error_loc01 + k);