diff mbox series

[3/5] mtd: rawnand: omap: Check return values

Message ID 20210610134906.3503303-4-miquel.raynal@bootlin.com
State Accepted
Headers show
Series AM335x large page support | expand

Commit Message

Miquel Raynal June 10, 2021, 1:49 p.m. UTC
Check the return value of many helpers which might return error codes.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/omap2.c | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

Comments

Miquel Raynal June 11, 2021, 7:01 p.m. UTC | #1
On Thu, 2021-06-10 at 13:49:04 UTC, Miquel Raynal wrote:
> Check the return value of many helpers which might return error codes.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next.

Miquel
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/omap2.c b/drivers/mtd/nand/raw/omap2.c
index cbe2c6ba510f..4b2ad77db71d 100644
--- a/drivers/mtd/nand/raw/omap2.c
+++ b/drivers/mtd/nand/raw/omap2.c
@@ -1527,7 +1527,9 @@  static int omap_write_page_bch(struct nand_chip *chip, const uint8_t *buf,
 	int ret;
 	uint8_t *ecc_calc = chip->ecc.calc_buf;
 
-	nand_prog_page_begin_op(chip, page, 0, NULL, 0);
+	ret = nand_prog_page_begin_op(chip, page, 0, NULL, 0);
+	if (ret)
+		return ret;
 
 	/* Enable GPMC ecc engine */
 	chip->ecc.hwctl(chip, NAND_ECC_WRITE);
@@ -1536,7 +1538,9 @@  static int omap_write_page_bch(struct nand_chip *chip, const uint8_t *buf,
 	chip->legacy.write_buf(chip, buf, mtd->writesize);
 
 	/* Update ecc vector from GPMC result registers */
-	omap_calculate_ecc_bch_multi(mtd, buf, &ecc_calc[0]);
+	ret = omap_calculate_ecc_bch_multi(mtd, buf, &ecc_calc[0]);
+	if (ret)
+		return ret;
 
 	ret = mtd_ooblayout_set_eccbytes(mtd, ecc_calc, chip->oob_poi, 0,
 					 chip->ecc.total);
@@ -1579,7 +1583,9 @@  static int omap_write_subpage_bch(struct nand_chip *chip, u32 offset,
 	 * ECC is calculated for all subpages but we choose
 	 * only what we want.
 	 */
-	nand_prog_page_begin_op(chip, page, 0, NULL, 0);
+	ret = nand_prog_page_begin_op(chip, page, 0, NULL, 0);
+	if (ret)
+		return ret;
 
 	/* Enable GPMC ECC engine */
 	chip->ecc.hwctl(chip, NAND_ECC_WRITE);
@@ -1638,7 +1644,9 @@  static int omap_read_page_bch(struct nand_chip *chip, uint8_t *buf,
 	int stat, ret;
 	unsigned int max_bitflips = 0;
 
-	nand_read_page_op(chip, page, 0, NULL, 0);
+	ret = nand_read_page_op(chip, page, 0, NULL, 0);
+	if (ret)
+		return ret;
 
 	/* Enable GPMC ecc engine */
 	chip->ecc.hwctl(chip, NAND_ECC_READ);
@@ -1647,13 +1655,17 @@  static int omap_read_page_bch(struct nand_chip *chip, uint8_t *buf,
 	chip->legacy.read_buf(chip, buf, mtd->writesize);
 
 	/* Read oob bytes */
-	nand_change_read_column_op(chip,
-				   mtd->writesize + BBM_LEN,
-				   chip->oob_poi + BBM_LEN,
-				   chip->ecc.total, false);
+	ret = nand_change_read_column_op(chip,
+					 mtd->writesize + BBM_LEN,
+					 chip->oob_poi + BBM_LEN,
+					 chip->ecc.total, false);
+	if (ret)
+		return ret;
 
 	/* Calculate ecc bytes */
-	omap_calculate_ecc_bch_multi(mtd, buf, ecc_calc);
+	ret = omap_calculate_ecc_bch_multi(mtd, buf, ecc_calc);
+	if (ret)
+		return ret;
 
 	ret = mtd_ooblayout_get_eccbytes(mtd, ecc_code, chip->oob_poi, 0,
 					 chip->ecc.total);