Re: [PATCH v5 01/15] dm: core: Fix uclass_probe_all to really probe all devices

2022-09-29 Thread Simon Glass
On Tue, 27 Sept 2022 at 15:38, Michal Suchanek  wrote:
>
> uclass_probe_all uses uclass_first_device/uclass_next_device assigning
> the return value.
>
> The interface for getting meaningful error is
> uclass_first_device_check/uclass_next_device_check, use it.
>
> Also do not stop iteration when an error is encountered. Probing all
> devices includes those that happen to be after a failing device in the
> uclass order.
>
> Fixes: a59153dfeb ("dm: core: add function uclass_probe_all() to probe all 
> devices")
> Signed-off-by: Michal Suchanek 
> ---
>  drivers/core/uclass.c | 12 +---
>  1 file changed, 5 insertions(+), 7 deletions(-)
>

Reviewed-by: Simon Glass 

but this could use a test e.g. in test/dm/core.c


[PATCH v5 01/15] dm: core: Fix uclass_probe_all to really probe all devices

2022-09-27 Thread Michal Suchanek
uclass_probe_all uses uclass_first_device/uclass_next_device assigning
the return value.

The interface for getting meaningful error is
uclass_first_device_check/uclass_next_device_check, use it.

Also do not stop iteration when an error is encountered. Probing all
devices includes those that happen to be after a failing device in the
uclass order.

Fixes: a59153dfeb ("dm: core: add function uclass_probe_all() to probe all 
devices")
Signed-off-by: Michal Suchanek 
---
 drivers/core/uclass.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 08d9ed82de..a591e22403 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -799,20 +799,18 @@ int uclass_pre_remove_device(struct udevice *dev)
 int uclass_probe_all(enum uclass_id id)
 {
struct udevice *dev;
-   int ret;
+   int ret, err;
 
-   ret = uclass_first_device(id, );
-   if (ret || !dev)
-   return ret;
+   err = uclass_first_device_check(id, );
 
/* Scanning uclass to probe all devices */
while (dev) {
-   ret = uclass_next_device();
+   ret = uclass_next_device_check();
if (ret)
-   return ret;
+   err = ret;
}
 
-   return 0;
+   return err;
 }
 
 int uclass_id_count(enum uclass_id id)
-- 
2.37.3