[U-Boot] [PATCH] dm: core: don't fail to iterate if first one fails to probe
Rob Clark
robdclark at gmail.com
Tue Jun 20 21:49:23 UTC 2017
efi_disk_register() would try to iterate all the blk devices. But if
the first one in the list failed to probe, uclass_first_device() would
return NULL and no attempt would be made to register the remaining
devices. Also uclass_next_device() needs the same fix.
Signed-off-by: Rob Clark <robdclark at gmail.com>
---
drivers/core/uclass.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 21dc696..c47ff56 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -458,14 +458,23 @@ int uclass_get_device_by_phandle(enum uclass_id id, struct udevice *parent,
int uclass_first_device(enum uclass_id id, struct udevice **devp)
{
- struct udevice *dev;
+ struct udevice *dev = NULL;
int ret;
*devp = NULL;
ret = uclass_find_first_device(id, &dev);
if (!dev)
return 0;
- return uclass_get_device_tail(dev, ret, devp);
+ ret = uclass_get_device_tail(dev, ret, devp);
+ if (ret && dev) {
+ /* we have a device, but it failed to probe, move on and
+ * try the next one.
+ */
+ ret = uclass_next_device(&dev);
+ if (!ret)
+ *devp = dev;
+ }
+ return ret;
}
int uclass_first_device_err(enum uclass_id id, struct udevice **devp)
@@ -490,7 +499,16 @@ int uclass_next_device(struct udevice **devp)
ret = uclass_find_next_device(&dev);
if (!dev)
return 0;
- return uclass_get_device_tail(dev, ret, devp);
+ ret = uclass_get_device_tail(dev, ret, devp);
+ if (ret && (dev != *devp)) {
+ /* we have a device, but it failed to probe, move on and
+ * try the next one.
+ */
+ ret = uclass_next_device(&dev);
+ if (!ret)
+ *devp = dev;
+ }
+ return ret;
}
int uclass_bind_device(struct udevice *dev)
--
2.9.4
More information about the U-Boot
mailing list