aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/physmap_of.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/maps/physmap_of.c')
-rw-r--r--drivers/mtd/maps/physmap_of.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index aeed9ea79714..d4bcd3f8c57c 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -94,14 +94,13 @@ static int __devinit parse_partitions(struct of_flash *info,
94 * line, these take precedence over device tree information */ 94 * line, these take precedence over device tree information */
95 nr_parts = parse_mtd_partitions(info->mtd, part_probe_types, 95 nr_parts = parse_mtd_partitions(info->mtd, part_probe_types,
96 &info->parts, 0); 96 &info->parts, 0);
97 if (nr_parts > 0) { 97 if (nr_parts > 0)
98 add_mtd_partitions(info->mtd, info->parts, nr_parts); 98 return nr_parts;
99 return 0;
100 }
101 99
102 /* First count the subnodes */ 100 /* First count the subnodes */
103 nr_parts = 0; 101 nr_parts = 0;
104 for (pp = dp->child; pp; pp = pp->sibling) 102 for (pp = of_get_next_child(dp, NULL); pp;
103 pp = of_get_next_child(dp, pp))
105 nr_parts++; 104 nr_parts++;
106 105
107 if (nr_parts == 0) 106 if (nr_parts == 0)
@@ -112,12 +111,14 @@ static int __devinit parse_partitions(struct of_flash *info,
112 if (!info->parts) 111 if (!info->parts)
113 return -ENOMEM; 112 return -ENOMEM;
114 113
115 for (pp = dp->child, i = 0; pp; pp = pp->sibling, i++) { 114 for (pp = of_get_next_child(dp, NULL), i = 0; pp;
115 pp = of_get_next_child(dp, pp), i++) {
116 const u32 *reg; 116 const u32 *reg;
117 int len; 117 int len;
118 118
119 reg = of_get_property(pp, "reg", &len); 119 reg = of_get_property(pp, "reg", &len);
120 if (!reg || (len != 2*sizeof(u32))) { 120 if (!reg || (len != 2*sizeof(u32))) {
121 of_node_put(pp);
121 dev_err(&dev->dev, "Invalid 'reg' on %s\n", 122 dev_err(&dev->dev, "Invalid 'reg' on %s\n",
122 dp->full_name); 123 dp->full_name);
123 kfree(info->parts); 124 kfree(info->parts);