aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ofpart.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ofpart.c')
-rw-r--r--drivers/mtd/ofpart.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index 3e164f0c9295..62d6a78c4eee 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -46,21 +46,12 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
46 const u32 *reg; 46 const u32 *reg;
47 int len; 47 int len;
48 48
49 /* check if this is a partition node */ 49 reg = of_get_property(pp, "reg", &len);
50 partname = of_get_property(pp, "name", &len); 50 if (!reg) {
51 if (strcmp(partname, "partition") != 0) {
52 nr_parts--; 51 nr_parts--;
53 continue; 52 continue;
54 } 53 }
55 54
56 reg = of_get_property(pp, "reg", &len);
57 if (!reg || (len != 2 * sizeof(u32))) {
58 of_node_put(pp);
59 dev_err(dev, "Invalid 'reg' on %s\n", node->full_name);
60 kfree(*pparts);
61 *pparts = NULL;
62 return -EINVAL;
63 }
64 (*pparts)[i].offset = reg[0]; 55 (*pparts)[i].offset = reg[0];
65 (*pparts)[i].size = reg[1]; 56 (*pparts)[i].size = reg[1];
66 57
@@ -75,6 +66,14 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
75 i++; 66 i++;
76 } 67 }
77 68
69 if (!i) {
70 of_node_put(pp);
71 dev_err(dev, "No valid partition found on %s\n", node->full_name);
72 kfree(*pparts);
73 *pparts = NULL;
74 return -EINVAL;
75 }
76
78 return nr_parts; 77 return nr_parts;
79} 78}
80EXPORT_SYMBOL(of_mtd_parse_partitions); 79EXPORT_SYMBOL(of_mtd_parse_partitions);