mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
mtd: ofpart: Check availability of reg property instead of name property
The previous implementation breaks the dts binding "mtd-physmap.txt". This implementation fixes the issue by checking the availability of the reg property instead of the name property. Cc: stable@kernel.org Signed-off-by: Benjamin Krill <ben@codiert.org> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
parent
9289d4ef06
commit
ebd5a74db7
1 changed files with 10 additions and 11 deletions
|
@ -46,21 +46,12 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
|
||||||
const u32 *reg;
|
const u32 *reg;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
/* check if this is a partition node */
|
reg = of_get_property(pp, "reg", &len);
|
||||||
partname = of_get_property(pp, "name", &len);
|
if (!reg) {
|
||||||
if (strcmp(partname, "partition") != 0) {
|
|
||||||
nr_parts--;
|
nr_parts--;
|
||||||
continue;
|
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].offset = reg[0];
|
||||||
(*pparts)[i].size = reg[1];
|
(*pparts)[i].size = reg[1];
|
||||||
|
|
||||||
|
@ -75,6 +66,14 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
|
||||||
i++;
|
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;
|
return nr_parts;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(of_mtd_parse_partitions);
|
EXPORT_SYMBOL(of_mtd_parse_partitions);
|
||||||
|
|
Loading…
Reference in a new issue