From: Simon Glass Date: Mon, 30 Dec 2019 04:19:18 +0000 (-0700) Subject: dm: core: Allocate parent data separate from probing parent X-Git-Tag: submit/tizen_6.0/20211217.073345~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=93ad5fde43700ef4e696d45172219deb9fd0be01;p=platform%2Fkernel%2Fu-boot.git dm: core: Allocate parent data separate from probing parent At present the parent is probed before the child's ofdata_to_platdata() method is called. Adjust the logic slightly so that probing parents is not done until afterwards. Change-Id: Ifa963cc3b287a746bc263a99a1526d3a36c2bbc7 Signed-off-by: Simon Glass --- diff --git a/drivers/core/device.c b/drivers/core/device.c index 56bf4758de..190d1fcfab 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -341,7 +341,7 @@ int device_probe(struct udevice *dev) } } - /* Ensure all parents are probed */ + /* Allocate parent data for this child */ if (dev->parent) { size = dev->parent->driver->per_child_auto_alloc_size; if (!size) { @@ -355,7 +355,17 @@ int device_probe(struct udevice *dev) goto fail; } } + } + + if (drv->ofdata_to_platdata && + (CONFIG_IS_ENABLED(OF_PLATDATA) || dev_has_of_node(dev))) { + ret = drv->ofdata_to_platdata(dev); + if (ret) + goto fail; + } + /* Ensure all parents are probed */ + if (dev->parent) { ret = device_probe(dev->parent); if (ret) goto fail; @@ -370,13 +380,6 @@ int device_probe(struct udevice *dev) return 0; } - if (drv->ofdata_to_platdata && - (CONFIG_IS_ENABLED(OF_PLATDATA) || dev_has_of_node(dev))) { - ret = drv->ofdata_to_platdata(dev); - if (ret) - goto fail; - } - seq = uclass_resolve_seq(dev); if (seq < 0) { ret = seq;