aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2022-01-09 20:18:27 +0100
committerFelix Fietkau <nbd@nbd.name>2022-01-13 18:33:06 +0100
commit0ddead089778e399d01a744d91eed3d665922bd4 (patch)
treec76fc1b65451f1cd48dff6990ad50213a6f72384 /target
parentb86452f8414d921058d800922849691a0fcfe2a6 (diff)
downloadupstream-0ddead089778e399d01a744d91eed3d665922bd4.tar.gz
upstream-0ddead089778e399d01a744d91eed3d665922bd4.tar.bz2
upstream-0ddead089778e399d01a744d91eed3d665922bd4.zip
kernel: mtk_bmt: pass number of bitflips on read to the caller
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c b/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c
index 14fbd246d7..84538f9180 100644
--- a/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c
+++ b/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c
@@ -497,6 +497,7 @@ mtk_bmt_read(struct mtd_info *mtd, loff_t from,
int retry_count = 0;
loff_t cur_from;
int ret = 0;
+ int max_bitflips = 0;
ops->retlen = 0;
ops->oobretlen = 0;
@@ -518,12 +519,14 @@ mtk_bmt_read(struct mtd_info *mtd, loff_t from,
cur_ret = bmtd._read_oob(mtd, cur_from, &cur_ops);
if (cur_ret < 0)
ret = cur_ret;
+ else
+ max_bitflips = max_t(int, max_bitflips, cur_ret);
if (cur_ret < 0 && !mtd_is_bitflip(cur_ret)) {
update_bmt(block, mtd->erasesize);
if (retry_count++ < 10)
continue;
- return ret;
+ goto out;
}
ops->retlen += cur_ops.retlen;
@@ -541,7 +544,11 @@ mtk_bmt_read(struct mtd_info *mtd, loff_t from,
retry_count = 0;
}
- return ret;
+out:
+ if (ret < 0)
+ return ret;
+
+ return max_bitflips;
}
static int