Skip to content

Commit 2781542

Browse files
richard-bootlinmiquelraynal
authored andcommitted
mtd: rawnand: sunxi: remove dead code
sunxi_nand_ooblayout_free() is only used in a code path where engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST So the other cases can be removed. Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent 548f87e commit 2781542

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

drivers/mtd/nand/raw/sunxi_nand.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,34 +1756,27 @@ static int sunxi_nand_ooblayout_free(struct mtd_info *mtd, int section,
17561756
struct nand_chip *nand = mtd_to_nand(mtd);
17571757
struct nand_ecc_ctrl *ecc = &nand->ecc;
17581758

1759-
if (section > ecc->steps)
1759+
/*
1760+
* The controller does not provide access to OOB bytes
1761+
* past the end of the ECC data.
1762+
*/
1763+
if (section >= ecc->steps)
17601764
return -ERANGE;
17611765

17621766
/*
17631767
* The first 2 bytes are used for BB markers, hence we
17641768
* only have USER_DATA_SZ - 2 bytes available in the first user data
17651769
* section.
17661770
*/
1767-
if (!section && ecc->engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST) {
1771+
if (section == 0) {
17681772
oobregion->offset = 2;
17691773
oobregion->length = USER_DATA_SZ - 2;
17701774

17711775
return 0;
17721776
}
17731777

1774-
/*
1775-
* The controller does not provide access to OOB bytes
1776-
* past the end of the ECC data.
1777-
*/
1778-
if (section == ecc->steps && ecc->engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST)
1779-
return -ERANGE;
1780-
17811778
oobregion->offset = section * (ecc->bytes + USER_DATA_SZ);
1782-
1783-
if (section < ecc->steps)
1784-
oobregion->length = USER_DATA_SZ;
1785-
else
1786-
oobregion->length = mtd->oobsize - oobregion->offset;
1779+
oobregion->length = USER_DATA_SZ;
17871780

17881781
return 0;
17891782
}

0 commit comments

Comments
 (0)