diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-07-16 14:36:26 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-07-18 13:54:20 +0200 |
commit | 9cb5f51d0aeca9b2f18019d05b7b09884809037d (patch) | |
tree | d52c6724d0604a5f0f61abde61ef37320fe7a757 /drivers/of/partition.c | |
parent | c7b4d3669c64ab13e0b35ef0329b8354713c05c5 (diff) | |
download | barebox-9cb5f51d0aeca9b2f18019d05b7b09884809037d.tar.gz barebox-9cb5f51d0aeca9b2f18019d05b7b09884809037d.tar.xz |
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>
Diffstat (limited to 'drivers/of/partition.c')
-rw-r--r-- | drivers/of/partition.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/of/partition.c b/drivers/of/partition.c index d69251e666..7199eff875 100644 --- a/drivers/of/partition.c +++ b/drivers/of/partition.c @@ -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); } |