aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/raw/atmel/nand-controller.c
diff options
context:
space:
mode:
authorAlex Dewar <[email protected]>2020-09-14 21:42:44 +0000
committerMiquel Raynal <[email protected]>2020-09-30 14:44:17 +0000
commitd27c9859a0c2f270972c26df6b2d2cc69c6d30f4 (patch)
treec7aab97fffadaf471403fd535afc429f413a873a /drivers/mtd/nand/raw/atmel/nand-controller.c
parentmtd: rawnand: vf610: Remove unused function vf610_nfc_transfer_size() (diff)
downloadkernel-d27c9859a0c2f270972c26df6b2d2cc69c6d30f4.tar.gz
kernel-d27c9859a0c2f270972c26df6b2d2cc69c6d30f4.zip
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 <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
Diffstat (limited to 'drivers/mtd/nand/raw/atmel/nand-controller.c')
-rw-r--r--drivers/mtd/nand/raw/atmel/nand-controller.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
index 309ce410d792..e6ceec8f50dc 100644
--- a/drivers/mtd/nand/raw/atmel/nand-controller.c
+++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
@@ -948,11 +948,17 @@ static int atmel_nand_pmecc_read_pg(struct nand_chip *chip, u8 *buf,
if (ret)
return ret;
- nand_read_data_op(chip, buf, mtd->writesize, false, false);
- nand_read_data_op(chip, chip->oob_poi, mtd->oobsize, false, false);
+ ret = nand_read_data_op(chip, buf, mtd->writesize, false, false);
+ if (ret)
+ goto out_disable;
+
+ ret = nand_read_data_op(chip, chip->oob_poi, mtd->oobsize, false, false);
+ if (ret)
+ goto out_disable;
ret = atmel_nand_pmecc_correct_data(chip, buf, raw);
+out_disable:
atmel_nand_pmecc_disable(chip, raw);
return ret;