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:
parent
c7b4d3669c
commit
9cb5f51d0a
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue