提交 a92c721d 编写于 作者: B Boris Brezillon

mtd: nand: sunxi: check ecc->size values

Verify that the ecc->size value is either 512 or 1024 bytes.
This should always be the case if this field was assigned to the
nand->ecc_step_size_ds value, but can be wrong when the user overloaded
this value with the nand-ecc-step-size DT property.
Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
上级 872164e4
......@@ -1786,6 +1786,9 @@ static int sunxi_nand_hw_common_ecc_ctrl_init(struct mtd_info *mtd,
if (!data)
return -ENOMEM;
if (ecc->size != 512 && ecc->size != 1024)
return -EINVAL;
/* Prefer 1k ECC chunk over 512 ones */
if (ecc->size == 512 && mtd->writesize > 512) {
ecc->size = 1024;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册