diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
index 538ffcc79108..e76f7cc67081 100644
--- a/drivers/mtd/nand/raw/sunxi_nand.c
+++ b/drivers/mtd/nand/raw/sunxi_nand.c
@@ -1070,41 +1070,12 @@ struct sunxi_nfc_ecc_read {
 	bool has_erased_chunk;
 };
 
-static int sunxi_nfc_hw_ecc_correct(struct nand_chip *nand, u8 *data, u8 *oob,
-				    int step, u32 status, u32 pattern_found,
-				    unsigned int user_data_sz, bool *erased)
+static unsigned int sunxi_nfc_hw_ecc_read_count(struct nand_chip *nand, int slot)
 {
 	struct sunxi_nfc *nfc = to_sunxi_nfc(nand->controller);
-	struct nand_ecc_ctrl *ecc = &nand->ecc;
-	u32 tmp;
-
-	*erased = false;
-
-	if (status & NFC_ECC_ERR(step))
-		return -EBADMSG;
-
-	if (pattern_found & BIT(step)) {
-		u8 pattern;
-
-		if (unlikely(!(readl(nfc->regs + NFC_REG_PAT_ID(nfc)) & BIT(step)))) {
-			pattern = 0x0;
-		} else {
-			pattern = 0xff;
-			*erased = true;
-		}
+	u32 count = readl(nfc->regs + NFC_REG_ECC_ERR_CNT(nfc, slot));
 
-		if (data)
-			memset(data, pattern, ecc->size);
-
-		if (oob)
-			memset(oob, pattern, ecc->bytes + user_data_sz);
-
-		return 0;
-	}
-
-	tmp = readl(nfc->regs + NFC_REG_ECC_ERR_CNT(nfc, step));
-
-	return NFC_ECC_ERR_CNT(step, tmp);
+	return NFC_ECC_ERR_CNT(slot, count);
 }
 
 /*
@@ -1203,35 +1174,38 @@ static int sunxi_nfc_oob_read_batch(struct nand_chip *nand,
 	struct nand_ecc_ctrl *ecc = &nand->ecc;
 	bool randomized = nand->options & NAND_NEED_SCRAMBLING;
 	unsigned int reg_index = 0, user_data_sz;
-	int i, ret;
+	int slot, ret;
 
-	for (i = 0; i < nsteps; i++, reg_index += user_data_sz / 4) {
-		int step = first_step + i;
+	for (slot = 0; slot < nsteps; slot++, reg_index += user_data_sz / 4) {
+		int step = first_step + slot;
 		int oob_off = sunxi_get_oob_offset(sunxi_nand, ecc, step);
 		u8 *data = read->buf + step * ecc->size;
 		u8 *oob = nand->oob_poi + oob_off;
-		bool erased;
 		int bitflips;
 
 		user_data_sz = sunxi_nfc_user_data_sz(sunxi_nand, step);
-		bitflips = sunxi_nfc_hw_ecc_correct(nand,
-						    !read->dma || randomized ? data : NULL,
-						    read->oob_required ? oob : NULL,
-						    i, status, pattern_found,
-						    user_data_sz, &erased);
-		if (bitflips < 0) {
+		if (status & NFC_ECC_ERR(slot)) {
 			/* Preserve PIO data before the raw erased-page check. */
 			if (!read->dma && !randomized)
 				memcpy_fromio(data, nfc->regs + NFC_RAM0_BASE, ecc->size);
 			continue;
 		}
 
-		/* Both patterns are already filled; only all-ones is erased. */
-		if (pattern_found & BIT(i)) {
-			read->has_erased_chunk |= erased;
+		if (pattern_found & BIT(slot)) {
+			u32 pattern_id = readl(nfc->regs + NFC_REG_PAT_ID(nfc));
+			u8 pattern = pattern_id & BIT(slot) ? 0xff : 0;
+
+			if (!read->dma || randomized)
+				memset(data, pattern, ecc->size);
+			if (read->oob_required)
+				memset(oob, pattern, ecc->bytes + user_data_sz);
+			if (pattern == 0xff)
+				read->has_erased_chunk = true;
 			continue;
 		}
 
+		bitflips = sunxi_nfc_hw_ecc_read_count(nand, slot);
+
 		if (!read->dma)
 			memcpy_fromio(data, nfc->regs + NFC_RAM0_BASE, ecc->size);
 
@@ -1260,10 +1234,10 @@ static int sunxi_nfc_oob_read_batch(struct nand_chip *nand,
 		return 0;
 
 	/* Finish consuming the batch's corrected OOB before raw error rereads. */
-	for (i = 0; i < nsteps; i++) {
-		int step = first_step + i;
+	for (slot = 0; slot < nsteps; slot++) {
+		int step = first_step + slot;
 
-		if (!(status & NFC_ECC_ERR(i)))
+		if (!(status & NFC_ECC_ERR(slot)))
 			continue;
 
 		ret = sunxi_nfc_hw_ecc_read_error(nand, read, step);
