diff options
author | Michal Suchanek <msuchanek@suse.de> | 2022-10-12 21:58:09 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2022-10-29 07:36:33 -0600 |
commit | f21954750aa8ed445ab83998bb099e366136c428 (patch) | |
tree | ada26fe279934fbb18d69324010b3ce1f55ffb63 /include/dm | |
parent | 4954937d922840c212b7eba297cc2d4779f087ad (diff) | |
download | u-boot-f21954750aa8ed445ab83998bb099e366136c428.tar.gz u-boot-f21954750aa8ed445ab83998bb099e366136c428.tar.bz2 u-boot-f21954750aa8ed445ab83998bb099e366136c428.zip |
dm: core: Do not stop uclass iteration on error
When probing a device fails NULL pointer is returned, and following
devices in uclass list cannot be iterated. Skip to next device on error
instead.
With that the only condition under which these simple iteration
functions return error is when the dm is not initialized at uclass_get
time. This is not all that interesting, change return type to void.
Fixes: 6494d708bf ("dm: Add base driver model support")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm')
-rw-r--r-- | include/dm/uclass.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/include/dm/uclass.h b/include/dm/uclass.h index b1c016ef9f..ee15c92063 100644 --- a/include/dm/uclass.h +++ b/include/dm/uclass.h @@ -320,32 +320,31 @@ int uclass_get_device_by_driver(enum uclass_id id, const struct driver *drv, * uclass_first_device() - Get the first device in a uclass * * The device returned is probed if necessary, and ready for use + * Devices that fail to probe are skipped * * This function is useful to start iterating through a list of devices which * are functioning correctly and can be probed. * * @id: Uclass ID to look up * @devp: Returns pointer to the first device in that uclass if no error - * occurred, or NULL if there is no first device, or an error occurred with - * that device. - * Return: 0 if OK (found or not found), other -ve on error + * occurred, or NULL if there is no usable device */ -int uclass_first_device(enum uclass_id id, struct udevice **devp); +void uclass_first_device(enum uclass_id id, struct udevice **devp); /** * uclass_next_device() - Get the next device in a uclass * * The device returned is probed if necessary, and ready for use + * Devices that fail to probe are skipped * * This function is useful to iterate through a list of devices which * are functioning correctly and can be probed. * * @devp: On entry, pointer to device to lookup. On exit, returns pointer * to the next device in the uclass if no error occurred, or NULL if there is - * no next device, or an error occurred with that next device. - * Return: 0 if OK (found or not found), other -ve on error + * no next device */ -int uclass_next_device(struct udevice **devp); +void uclass_next_device(struct udevice **devp); /** * uclass_first_device_err() - Get the first device in a uclass |