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-11 10:08:04 +0200
commite648666112e7e99de621277e7c895a0341bd3c9d (patch)
tree0ef0712317c0eed00bae218b40d9cd741287677d
parent35f3890d2b724c6adb79281413fe6f60c552ca20 (diff)
downloadbarebox-e648666112e7e99de621277e7c895a0341bd3c9d.tar.gz
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 a5886df..334eab8 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);