[PATCH v2 2/5] mtd: mtdpart: Do not fail mtd probe when parsing partitions fails.

Michal Suchanek
2015-07-31T11:19:51Z

Due to wrong assumption in ofpart ofpart fails on Exynos on SPI chips
with no partitions because the subnode containing controller data
confuses the ofpart parser.

Thus compiling in ofpart support automatically fails probing any SPI NOR
flash without partitions on Exynos.

Compiling in a partitioning scheme should not cause probe of otherwise
valid device to fail.

Remove that failure possibility when MTD_PARTITIONED_MASTER is set.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>

---
v2:

- only allow partition parsing failure when MTD_PARTITIONED_MASTER is
set
---
drivers/mtd/mtdpart.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 31888c2..6eafbe9 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -774,10 +774,15 @@ int parse_mtd_partitions(struct mtd_info *master, const char *const *types,
if (ret > 0) {
printk(KERN_NOTICE "%d %s partitions found on MTD device %s\n",
ret, parser->name, master->name);
- break;
+ return ret;
+ }
+ if (!IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER) && (ret < 0)) {
+ pr_err("Error parsing %s partitions on %s\n",
+ parser->name, master->name);
+ return ret;
}
}
- return ret;
+ return 0;
}

int mtd_is_partition(const struct mtd_info *mtd)
--
2.1.4