[PATCH 2/3] mtd: nand: atmel: legacy: use proper ecc_shift

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The logic of the ternary operator is broken because '1 << x' is always
true even if 'x' is 0. Convert the logic to really use either the pdata
value or a sane default. Fixes "WARNING: Total number of ECC bytes
exceeded oobsize" on my USB-A9G20.

Fixes: babffbb193 ("mtd: atmel_nand: Add per board ECC setup")
Signed-off-by: Wolfram Sang <wsa@xxxxxxxxxx>
---

The other option is to revert babffbb193. I don't see any user. The code
was obviously not enough tested as well.

 drivers/mtd/nand/atmel/legacy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/atmel/legacy.c b/drivers/mtd/nand/atmel/legacy.c
index ea1fd64ad8..184cf465e3 100644
--- a/drivers/mtd/nand/atmel/legacy.c
+++ b/drivers/mtd/nand/atmel/legacy.c
@@ -1240,7 +1240,7 @@ static int __init atmel_nand_probe(struct device *dev)
 
 	nand_chip->ecc.mode = pdata->ecc_mode;
 	nand_chip->ecc.strength = pdata->ecc_strength ? : 1;
-	nand_chip->ecc.size = 1 << pdata->ecc_size_shift ? : 512;
+	nand_chip->ecc.size = 1 << (pdata->ecc_size_shift ? : 9);
 
 	if (pdata->ecc_mode == NAND_ECC_HW) {
 		nand_chip->ecc.mode = NAND_ECC_HW;
-- 
2.35.1





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux