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: 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>

authored by

Richard Genoud and committed by
Miquel Raynal
2781542c 548f87ed

+7 -14
+7 -14
drivers/mtd/nand/raw/sunxi_nand.c
··· 1756 1756 struct nand_chip *nand = mtd_to_nand(mtd); 1757 1757 struct nand_ecc_ctrl *ecc = &nand->ecc; 1758 1758 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) 1760 1764 return -ERANGE; 1761 1765 1762 1766 /* ··· 1768 1764 * only have USER_DATA_SZ - 2 bytes available in the first user data 1769 1765 * section. 1770 1766 */ 1771 - if (!section && ecc->engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST) { 1767 + if (section == 0) { 1772 1768 oobregion->offset = 2; 1773 1769 oobregion->length = USER_DATA_SZ - 2; 1774 1770 1775 1771 return 0; 1776 1772 } 1777 1773 1778 - /* 1779 - * The controller does not provide access to OOB bytes 1780 - * past the end of the ECC data. 1781 - */ 1782 - if (section == ecc->steps && ecc->engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST) 1783 - return -ERANGE; 1784 - 1785 1774 oobregion->offset = section * (ecc->bytes + USER_DATA_SZ); 1786 - 1787 - if (section < ecc->steps) 1788 - oobregion->length = USER_DATA_SZ; 1789 - else 1790 - oobregion->length = mtd->oobsize - oobregion->offset; 1775 + oobregion->length = USER_DATA_SZ; 1791 1776 1792 1777 return 0; 1793 1778 }