mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
nand: add a error handler in aml_nand_add_partition
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>
This commit is contained in:
@@ -328,7 +328,7 @@
|
||||
};
|
||||
system{
|
||||
offset=<0x0 0x0>;
|
||||
size=<0x0 0xDC40000>;
|
||||
size=<0x0 0xDC00000>;
|
||||
};
|
||||
data{
|
||||
offset=<0xffffffff 0xffffffff>;
|
||||
|
||||
@@ -434,6 +434,12 @@ static int aml_nand_add_partition(struct aml_nand_chip *aml_chip)
|
||||
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",
|
||||
|
||||
@@ -259,7 +259,8 @@ static int mtd_nand_probe(struct platform_device *pdev)
|
||||
/*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;
|
||||
|
||||
Reference in New Issue
Block a user