[PATCH] mtd: Fix physmap_of to not exit upon unsuccessful partition scan

Peter Korsgaard jacmet at sunsite.dk
Thu Feb 14 07:49:04 EST 2008


>>>>> "Stefan" == Stefan Roese <sr at denx.de> writes:

 Stefan> On Tuesday 12 February 2008, Scott Wood wrote:
 >> >> Under what conditions are you actually seeing this fail?
 >> >
 >> > When CONFIG_MTD_REDBOOT_PARTS is not defined for example it returns with
 >> > -22 (EINVAL).
 >> 
 >> Ah, I see -- it seems the cmdline partition code behaves differently
 >> than the redboot code.
 >> 
 >> Your patch changes it to treat zero as success, however -- which breaks
 >> some other cases.  The test should be "err <= 0", which is what
 >> parse_mtd_partiitions() itself uses in its loop.

 Stefan> OK, I'll fixup another version of this patch tomorrow.

I would prefer to fix up cmdlinepart.c instead, as missing cmdline
data isn't really an error.

>From 7cc1d55f9704a9df1053aefd21fd5db98ac4c983 Mon Sep 17 00:00:00 2001
From: Peter Korsgaard <jacmet at sunsite.dk>
Date: Thu, 14 Feb 2008 13:46:13 +0100
Subject: [PATCH] cmdlinepart: Missing partition info is not an error

Return 0 partitions instead of -EINVAL on no mtdpart= argument on kernel
cmdline or missing partition info for device.
---
 drivers/mtd/cmdlinepart.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c
index b44292a..08b82c9 100644
--- a/drivers/mtd/cmdlinepart.c
+++ b/drivers/mtd/cmdlinepart.c
@@ -308,9 +308,6 @@ static int parse_cmdline_partitions(struct mtd_info *master,
 	struct cmdline_mtd_partition *part;
 	char *mtd_id = master->name;
 
-	if(!cmdline)
-		return -EINVAL;
-
 	/* parse command line */
 	if (!cmdline_parsed)
 		mtdpart_setup_real(cmdline);
@@ -341,7 +338,7 @@ static int parse_cmdline_partitions(struct mtd_info *master,
 			return part->num_parts;
 		}
 	}
-	return -EINVAL;
+	return 0;
 }
 
 
-- 
debian.1.5.3.7.1-dirty


-- 
Bye, Peter Korsgaard



More information about the linux-mtd mailing list