diff options
author | Chuanhong Guo <gch981213@gmail.com> | 2023-01-21 10:47:59 +0800 |
---|---|---|
committer | Chuanhong Guo <gch981213@gmail.com> | 2023-01-21 10:54:23 +0800 |
commit | f183ce35b8ea2fd991ac489fb223b09a1ecb4db0 (patch) | |
tree | 228f18c4ba684f051d90b2dffa48d6741d3640cc /target/linux/generic/files/drivers/mtd/nand/mtk_bmt.h | |
parent | 5d409062a30ce39c0f80252ca3f2bcecb1443de5 (diff) | |
download | upstream-f183ce35b8ea2fd991ac489fb223b09a1ecb4db0.tar.gz upstream-f183ce35b8ea2fd991ac489fb223b09a1ecb4db0.tar.bz2 upstream-f183ce35b8ea2fd991ac489fb223b09a1ecb4db0.zip |
kernel: mtk-bmt: fix usage of _oob_read
_oob_read returns number of bitflips on success while
bbt_nand_read should return 0.
Fixes: 2d49e49b18 ("mediatek: bmt: use generic mtd api")
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Diffstat (limited to 'target/linux/generic/files/drivers/mtd/nand/mtk_bmt.h')
-rw-r--r-- | target/linux/generic/files/drivers/mtd/nand/mtk_bmt.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.h b/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.h index dff1f28c81..517ff7414f 100644 --- a/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.h +++ b/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.h @@ -95,8 +95,14 @@ bbt_nand_read(u32 page, unsigned char *dat, int dat_len, .datbuf = dat, .len = dat_len, }; - - return bmtd._read_oob(bmtd.mtd, page << bmtd.pg_shift, &ops); + int ret; + + ret = bmtd._read_oob(bmtd.mtd, page << bmtd.pg_shift, &ops); + if (ret < 0) + return ret; + if (ret) + pr_info("%s: %d bitflips\n", __func__, ret); + return 0; } static inline int bbt_nand_erase(u16 block) |