Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 165481
b: refs/heads/master
c: ebd5a74
h: refs/heads/master
i:
  165479: e402174
v: v3
  • Loading branch information
Benjamin Krill authored and David Woodhouse committed Sep 19, 2009
1 parent 477ba05 commit 9dc99c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9289d4ef065a6c62db6bf13d624307f61e57dbbb
refs/heads/master: ebd5a74db74ee2db833d43ea35108a4be9cab42f
21 changes: 10 additions & 11 deletions trunk/drivers/mtd/ofpart.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,12 @@ 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) {
reg = of_get_property(pp, "reg", &len);
if (!reg) {
nr_parts--;
continue;
}

reg = of_get_property(pp, "reg", &len);
if (!reg || (len != 2 * sizeof(u32))) {
of_node_put(pp);
dev_err(dev, "Invalid 'reg' on %s\n", node->full_name);
kfree(*pparts);
*pparts = NULL;
return -EINVAL;
}
(*pparts)[i].offset = reg[0];
(*pparts)[i].size = reg[1];

Expand All @@ -75,6 +66,14 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
i++;
}

if (!i) {
of_node_put(pp);
dev_err(dev, "No valid partition found on %s\n", node->full_name);
kfree(*pparts);
*pparts = NULL;
return -EINVAL;
}

return nr_parts;
}
EXPORT_SYMBOL(of_mtd_parse_partitions);
Expand Down

0 comments on commit 9dc99c7

Please sign in to comment.