mtd: rawnand: cortina_nand: missing initialization
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 20 Feb 2021 09:42:50 +0000 (10:42 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 24 Feb 2021 21:51:49 +0000 (16:51 -0500)
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

index 12bd1de..81fa878 100644 (file)
@@ -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);