Skip to content

Commit d27c985

Browse files
alexdewarmiquelraynal
authored andcommitted
mtd: rawnand: atmel: Check return values for nand_read_data_op
In atmel_nand_pmecc_read_pg(), nand_read_data_op() is called twice without the return values being checked for errors. Add these checks. Signed-off-by: Alex Dewar <alex.dewar90@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20200914214245.14626-1-alex.dewar90@gmail.com
1 parent f7721e4 commit d27c985

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

drivers/mtd/nand/raw/atmel/nand-controller.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,11 +948,17 @@ static int atmel_nand_pmecc_read_pg(struct nand_chip *chip, u8 *buf,
948948
if (ret)
949949
return ret;
950950

951-
nand_read_data_op(chip, buf, mtd->writesize, false, false);
952-
nand_read_data_op(chip, chip->oob_poi, mtd->oobsize, false, false);
951+
ret = nand_read_data_op(chip, buf, mtd->writesize, false, false);
952+
if (ret)
953+
goto out_disable;
954+
955+
ret = nand_read_data_op(chip, chip->oob_poi, mtd->oobsize, false, false);
956+
if (ret)
957+
goto out_disable;
953958

954959
ret = atmel_nand_pmecc_correct_data(chip, buf, raw);
955960

961+
out_disable:
956962
atmel_nand_pmecc_disable(chip, raw);
957963

958964
return ret;

0 commit comments

Comments
 (0)