summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-05-11 10:06:41 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-05-24 09:15:48 +0200
commit811cd961093c168648f349960762b98d7b337086 (patch)
tree5ca50fc1c56eb0a95ef75fd2d4aa9fffb83c6990
parenteead1070abee567eb7db708f42b319e26e92de74 (diff)
downloadbarebox-811cd961093c168648f349960762b98d7b337086.tar.gz
barebox-811cd961093c168648f349960762b98d7b337086.tar.xz
of: of_find_node_by_devpath: Fix offset in mtd devices
When a cdev is a mtd device the partition offset must be used from there, not from the cdev. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/of/of_path.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
index a5886dffac..334eab841a 100644
--- a/drivers/of/of_path.c
+++ b/drivers/of/of_path.c
@@ -142,7 +142,10 @@ struct device_node *of_find_node_by_devpath(struct device_node *root, const char
*/
if (cdev->master) {
is_partition = true;
- part_offset = cdev->offset;
+ if (cdev->mtd)
+ part_offset = cdev->mtd->master_offset;
+ else
+ part_offset = cdev->offset;
part_size = cdev->size;
pr_debug("%s path %s: is a partition with offset 0x%08llx, size 0x%08llx\n",
__func__, path, part_offset, part_size);