[PATCH v2] Check name property to determine partition nodes.

Benjamin Krill ben at codiert.org
Fri Jan 23 11:18:05 EST 2009


SLOF has a further node which could not be evaluate
by the current routine. The current routine returns
because the node hasn't the required reg property. As
fix this patch adds a check to determine the partition
child nodes. If the node is not an partition the number
of total partitions will be decreased and loop continue
with the next nodes.

Signed-off-by: Benjamin Krill <ben at codiert.org>
---
 drivers/mtd/ofpart.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index 9e45b3f..3e164f0 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -46,6 +46,13 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
 		const u32 *reg;
 		int len;
 
+		/* check if this is a partition node */
+		partname = of_get_property(pp, "name", &len);
+		if (strcmp(partname, "partition") != 0) {
+			nr_parts--;
+			continue;
+		}
+
 		reg = of_get_property(pp, "reg", &len);
 		if (!reg || (len != 2 * sizeof(u32))) {
 			of_node_put(pp);
-- 
1.6.0.6




More information about the linux-mtd mailing list