[U-Boot] [PATCH 1/1] core/uclass: uclass_get_device_tail: always set devp

Heinrich Schuchardt
2017-04-18T18:44:49Z

Set devp even if probing fails.

Without the patch the following problem occurs:
If the first block device is not probed successfully no block
device is passed by bootefi to the EFI executable.

The problem was reported by Andreas Färber in
https://lists.denx.de/pipermail/u-boot/2017-April/287432.html

For testing I used an odroid-c2 with a dts including
&sd_emmc_a {
status = "okay";
}
This device does not exist on the board and cannot be initialized.

Reported-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
drivers/core/uclass.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 04fb45b..b647384 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -349,12 +349,13 @@ int uclass_get_device_tail(struct udevice *dev, int ret,
return ret;

assert(dev);
+
+ *devp = dev;
+
ret = device_probe(dev);
if (ret)
return ret;

- *devp = dev;
-
return 0;
}

--
2.1.4