9
0
Fork 0

of: partition: check for valid node

So that users can call the of partition parsers without checking
if they are probed from the devicetree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2013-07-16 14:36:26 +02:00
parent c7b4d3669c
commit 9cb5f51d0a
1 changed files with 6 additions and 0 deletions

View File

@ -34,6 +34,9 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node)
int len;
unsigned long flags = 0;
if (!node)
return NULL;
reg = of_get_property(node, "reg", &len);
if (!reg)
return NULL;
@ -67,6 +70,9 @@ int of_parse_partitions(struct cdev *cdev, struct device_node *node)
{
struct device_node *n;
if (!node)
return -EINVAL;
for_each_child_of_node(node, n) {
of_parse_partition(cdev, n);
}