Skip to contentSkip to conversation

mtd: Fix physmap_of to not exit upon unsuccessful partition scan

PATCH In review Stefan Roese 2 participants 3 messages Feb 13, 2008 – Feb 14, 2008 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mtd: Fix physmap_of to not exit upon unsuccessful partition scan

The patch 9a310d21196f38f6ad0ad146057548653e495c09 ("[MTD] Factor out OF partition support from the NOR driver.") introduced an problem. Now the physmap_of driver returns with error upon the first unsuccessful partition scan (parse_mtd_partitions()). This is not wanted, since even when the RedBoot/cmdlinepart partition scan is unsuccessful, the other scan's (of_mtd_parse_partitions(), parse_obsolete_partitions()) should be done nevertheless.

This patch fixes this problem.

---
 drivers/mtd/maps/physmap_of.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)
drivers/mtd/maps/physmap_of.c +4 -12
index 49acd41..09a78ea 100644
@@ -224,24 +224,16 @@ static int __devinit of_flash_probe(struct of_device *dev,
 	/* First look for RedBoot table or partitions on the command
 	 * line, these take precedence over device tree information */
 	err = parse_mtd_partitions(info->mtd, part_probe_types,
-	                           &info->parts, 0);
-	if (err < 0)
-		return err;
+				   &info->parts, 0);
 
 #ifdef CONFIG_MTD_OF_PARTS
-	if (err == 0) {
+	if (err <= 0)
 		err = of_mtd_parse_partitions(&dev->dev, info->mtd,
-		                              dp, &info->parts);
-		if (err < 0)
-			return err;
-	}
+					      dp, &info->parts);
 #endif
 
-	if (err == 0) {
+	if (err <= 0)
 		err = parse_obsolete_partitions(dev, info, dp);
-		if (err < 0)
-			return err;
-	}
 
 	if (err > 0)
 		add_mtd_partitions(info->mtd, info->parts, err);
Signature · 1 line
1.5.4.1
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Stefan" == Stefan Roese <[email protected]> writes:

Stefan> The patch 9a310d21196f38f6ad0ad146057548653e495c09 ("[MTD] Stefan> Factor out OF partition support from the NOR driver.") Stefan> introduced an problem. Now the physmap_of driver returns with Stefan> error upon the first unsuccessful partition scan Stefan> (parse_mtd_partitions()). This is not wanted, since even when Stefan> the RedBoot/cmdlinepart partition scan is unsuccessful, the Stefan> other scan's (of_mtd_parse_partitions(),
Stefan> parse_obsolete_partitions()) should be done nevertheless.

Doesn't it make more sense to fix the real problem (E.G. cmdlinepart.c flagging missing partition info as an error) - See the patch I posted earlier today.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw
Quoted 11 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Stefan" == Stefan Roese <[email protected]> writes:

Stefan> The patch 9a310d21196f38f6ad0ad146057548653e495c09 ("[MTD] Stefan> Factor out OF partition support from the NOR driver.") Stefan> introduced an problem. Now the physmap_of driver returns with Stefan> error upon the first unsuccessful partition scan Stefan> (parse_mtd_partitions()). This is not wanted, since even when Stefan> the RedBoot/cmdlinepart partition scan is unsuccessful, the Stefan> other scan's (of_mtd_parse_partitions(),
Stefan> parse_obsolete_partitions()) should be done nevertheless.

Quoted 3 lines

Doesn't it make more sense to fix the real problem (E.G. cmdlinepart.c flagging missing partition info as an error) - See the patch I posted earlier today.

Yes, this is probably even better. I just tested it successfully on my board.

Do you plan to post a "real patch" with Signed-off-by? You can add my Acked-by too then.

BTW: I would really like to see one of the solutions go into 2.6.25 since it's really a bug fix.

Thanks.

Best regards,
Stefan