mtd: nand: sunxi: Fix ECC strength choice
authorMiquel Raynal <miquel.raynal@free-electrons.com>
Wed, 24 Jan 2018 22:49:31 +0000 (23:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Feb 2018 19:22:57 +0000 (20:22 +0100)
commit7eb52a6889e90bcb1280cf2d93f8a80602191d5c
tree200deca0027d85e16483745a7d2f4a5e2e732e5e
parent16d11602c83b45f448355e02dd97a0d855016ef3
mtd: nand: sunxi: Fix ECC strength choice

commit f4c6cd1a7f2275d5bc0e494b21fff26f8dde80f0 upstream.

When the requested ECC strength does not exactly match the strengths
supported by the ECC engine, the driver is selecting the closest
strength meeting the 'selected_strength > requested_strength'
constraint. Fix the fact that, in this particular case, ecc->strength
value was not updated to match the 'selected_strength'.

For instance, one can encounter this issue when no ECC requirement is
filled in the device tree while the NAND chip minimum requirement is not
a strength/step_size combo natively supported by the ECC engine.

Fixes: 1fef62c1423b ("mtd: nand: add sunxi NAND flash controller support")
Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/nand/sunxi_nand.c