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

Configure Feed

Select the types of activity you want to include in your feed.

mtd: rawnand: sunxi: replace hard coded value by a define - take2

The user data length (4) has been replaced almost all over the file, but
2 places were forgotten.

The user data is placed before the ECC, for each step.
So, in sunxi_nfc_hw_ecc_read_extra_oob(), the offset of the user data in
OOB is indeed ((ecc->bytes + USER_DATA_SZ) * ecc->steps);

And in sunxi_nand_ooblayout_ecc(), the offset of the ECC chunk in OOB is
the same offset plus the current user data size:
section * (ecc->bytes + USER_DATA_SZ) + USER_DATA_SZ;

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

authored by

Richard Genoud and committed by
Miquel Raynal
e3fd963d 8fa72836

+2 -2
+2 -2
drivers/mtd/nand/raw/sunxi_nand.c
··· 1045 1045 { 1046 1046 struct mtd_info *mtd = nand_to_mtd(nand); 1047 1047 struct nand_ecc_ctrl *ecc = &nand->ecc; 1048 - int offset = ((ecc->bytes + 4) * ecc->steps); 1048 + int offset = ((ecc->bytes + USER_DATA_SZ) * ecc->steps); 1049 1049 int len = mtd->oobsize - offset; 1050 1050 1051 1051 if (len <= 0) ··· 1741 1741 if (section >= ecc->steps) 1742 1742 return -ERANGE; 1743 1743 1744 - oobregion->offset = section * (ecc->bytes + USER_DATA_SZ) + 4; 1744 + oobregion->offset = section * (ecc->bytes + USER_DATA_SZ) + USER_DATA_SZ; 1745 1745 oobregion->length = ecc->bytes; 1746 1746 1747 1747 return 0;