Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22c18fde authored by Nikhilesh Reddy's avatar Nikhilesh Reddy Committed by Gerrit - the friendly Code Review server
Browse files

mtd: msm_qpic_nand: Continue reading pages when ECC errors occur



Upper layers like UBI/UBIFS expect muti page reads to continue
reading pages even if ECC errors occur.
Fix multi-page read to continue on correctable bitflips to
read the expected length of data and then return EBADMSG.

Change-Id: I01e782f0639d34430559c64464f7d1babcdd69cb
Signed-off-by: default avatarNikhilesh Reddy <reddyn@codeaurora.org>
parent 50239ba4
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -1975,6 +1975,7 @@ static int msm_nand_read_partial_page(struct mtd_info *mtd,
	size_t len;
	size_t actual_len, ret_len;
	int is_euclean = 0;
	int is_ebadmsg = 0;

	actual_len = ops->len;
	ret_len = 0;
@@ -2012,8 +2013,13 @@ static int msm_nand_read_partial_page(struct mtd_info *mtd,
			err = 0;
		}

		if (err == -EBADMSG) {
			is_ebadmsg = 1;
			err = 0;
		}

		if (err < 0) {
			/* Clear previously set EUCLEAN */
			/* Clear previously set EUCLEAN / EBADMSG */
			is_euclean = 0;
			ret_len = ops->retlen;
			break;
@@ -2038,6 +2044,10 @@ static int msm_nand_read_partial_page(struct mtd_info *mtd,
out:
	if (is_euclean == 1)
		err = -EUCLEAN;

	/* Snub EUCLEAN if we also have EBADMSG */
	if (is_ebadmsg == 1)
		err = -EBADMSG;
	return err;
}