Skip to content

Commit e3fd963

Browse files
richard-bootlinmiquelraynal
authored andcommitted
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>
1 parent 8fa7283 commit e3fd963

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/mtd/nand/raw/sunxi_nand.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ static void sunxi_nfc_hw_ecc_read_extra_oob(struct nand_chip *nand,
10451045
{
10461046
struct mtd_info *mtd = nand_to_mtd(nand);
10471047
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);
10491049
int len = mtd->oobsize - offset;
10501050

10511051
if (len <= 0)
@@ -1741,7 +1741,7 @@ static int sunxi_nand_ooblayout_ecc(struct mtd_info *mtd, int section,
17411741
if (section >= ecc->steps)
17421742
return -ERANGE;
17431743

1744-
oobregion->offset = section * (ecc->bytes + USER_DATA_SZ) + 4;
1744+
oobregion->offset = section * (ecc->bytes + USER_DATA_SZ) + USER_DATA_SZ;
17451745
oobregion->length = ecc->bytes;
17461746

17471747
return 0;

0 commit comments

Comments
 (0)