summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-03-30 15:45:50 +0900
committerBoris Brezillon <boris.brezillon@free-electrons.com>2017-04-25 14:18:33 +0200
commit20d48595f8857c9b7e0d31d9734ebe18d63faea1 (patch)
tree96548aa5cc8ca01c0dd597a88a37deca02df67c4 /drivers/block
parent8927ad394b0653329184863e3d44958f67705e84 (diff)
downloadtalos-obmc-linux-20d48595f8857c9b7e0d31d9734ebe18d63faea1.tar.gz
talos-obmc-linux-20d48595f8857c9b7e0d31d9734ebe18d63faea1.zip
mtd: nand: denali: fix bitflips calculation in handle_ecc()
This function is wrong in multiple ways: [1] Counting corrected bytes instead of corrected bits. The following code is counting the number of corrected _bytes_. /* correct the ECC error */ buf[offset] ^= err_cor_value; mtd->ecc_stats.corrected++; bitflips++; What the core framework expects is the number of corrected _bits_. They can be different if multiple bitflips occur within one byte. [2] total number of errors instead of max of per-sector errors The core framework expects that corrected errors are counted per sector, then the max value should be taken. The current code simply iterates over the whole page, i.e. counts the total number of correction in the page. This means "too many bitflips" is triggered earlier than it should be, i.e. the NAND device is worn out sooner. Besides those bugs, this function is unreadable due to the deep nesting. Notice the whole code in this function is wrapped in if (irq_status & INTR__ECC_ERR), so this conditional can be moved out of the function. Also, use shorter names for local variables. Re-work the function to fix all the issues. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Diffstat (limited to 'drivers/block')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud