diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-01-13 14:38:23 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-01-19 15:21:29 +0100 |
commit | 32da9097e71d917803ab244ffdddeb3bead00d41 (patch) | |
tree | b26061ea6f4d8f711ce3c27b279776580f9723f0 /drivers/of | |
parent | 1b3fde398378f2446b8560a567d1e69b84ba754e (diff) | |
download | barebox-32da9097e71d917803ab244ffdddeb3bead00d41.tar.gz barebox-32da9097e71d917803ab244ffdddeb3bead00d41.tar.xz |
of: partitions: force "partitions" subnode
The binding states that a subnode containing partition subnodes
should have the name "partitions". Enforce this so that we do not
parse nodes with other names which may have partition descriptions
for other disks.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/partition.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/of/partition.c b/drivers/of/partition.c index bdf5945627..8c2aef2326 100644 --- a/drivers/of/partition.c +++ b/drivers/of/partition.c @@ -74,16 +74,16 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node) int of_parse_partitions(struct cdev *cdev, struct device_node *node) { - struct device_node *n; + struct device_node *n, *subnode; if (!node) return -EINVAL; - for_each_child_of_node(node, n) { - if (of_device_is_compatible(n, "fixed-partitions")) { - node = n; - break; - } + subnode = of_get_child_by_name(node, "partitions"); + if (subnode) { + if (!of_device_is_compatible(subnode, "fixed-partitions")) + return -EINVAL; + node = subnode; } for_each_child_of_node(node, n) { |