Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: rawnand: txx9ndfmc: Fix external use of SW Hamming ECC helper

Since the Hamming software ECC engine has been updated to become a
proper and independent ECC engine, it is now mandatory to either
initialize the engine before using any one of his functions or use one
of the bare helpers which only perform the calculations. As there is no
actual need for a proper ECC initialization, let's just use the bare
helper instead of the rawnand one.

Fixes: 90ccf0a0192f ("mtd: nand: ecc-hamming: Rename the exported functions")
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210413161840.345208-8-miquel.raynal@bootlin.com

+3 -2
+3 -2
drivers/mtd/nand/raw/txx9ndfmc.c
··· 13 13 #include <linux/platform_device.h> 14 14 #include <linux/delay.h> 15 15 #include <linux/mtd/mtd.h> 16 + #include <linux/mtd/nand-ecc-sw-hamming.h> 16 17 #include <linux/mtd/rawnand.h> 17 18 #include <linux/mtd/partitions.h> 18 19 #include <linux/io.h> ··· 194 193 int stat; 195 194 196 195 for (eccsize = chip->ecc.size; eccsize > 0; eccsize -= 256) { 197 - stat = rawnand_sw_hamming_correct(chip, buf, read_ecc, 198 - calc_ecc); 196 + stat = ecc_sw_hamming_correct(buf, read_ecc, calc_ecc, 197 + chip->ecc.size, false); 199 198 if (stat < 0) 200 199 return stat; 201 200 corrected += stat;