PD#156335: nand: add a error handler in aml_nand_add_partition
add a error handler in aml_nand_add_partition to avoid the endless
loop, when dts config a over size partition.
Change-Id: I8375990283bc6b36a09e09a37d041ebd929990d6
Signed-off-by: Yi Zeng <yi.zeng@amlogic.com>
};
system{
offset=<0x0 0x0>;
- size=<0x0 0xDC40000>;
+ size=<0x0 0xDC00000>;
};
data{
offset=<0xffffffff 0xffffffff>;
start_blk = 0;
do {
offset = adjust_offset + start_blk * mtd->erasesize;
+ if (offset > mtd->size) {
+ pr_info("%s %d error : over the nand size!!!\n",
+ __func__, __LINE__);
+ WARN_ON(1);
+ return -ENOMEM;
+ }
error = mtd->_block_isbad(mtd, offset);
if (error == FACTORY_BAD_BLOCK_ERROR) {
pr_info("%s:%d factory bad addr=%llx\n",
/*prase dtb and get device(part) information*/
prase_get_dtb_nand_parameter(aml_nand_dev, pdev);
- nand_init(pdev);
+ err = nand_init(pdev);
+ pr_info("%s %d , err = %d\n", __func__, __LINE__, err);
exit_error:
return err;