dm: treewide: Do not use the return value of simple uclass iterator
uclass_first_device/uclass_next_device return value will be removed,
don't use it.
With the current implementation dev is equivalent to !ret. It is
redundant to check both, ret check can be replaced with dev check, and
ret check inside the iteration is dead code.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 6503325..3a6ef3b 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -59,11 +59,10 @@
{
struct gpio_dev_priv *uc_priv;
struct udevice *dev;
- int ret;
- for (ret = uclass_first_device(UCLASS_GPIO, &dev);
+ for (uclass_first_device(UCLASS_GPIO, &dev);
dev;
- ret = uclass_next_device(&dev)) {
+ uclass_next_device(&dev)) {
uc_priv = dev_get_uclass_priv(dev);
if (gpio >= uc_priv->gpio_base &&
gpio < uc_priv->gpio_base + uc_priv->gpio_count) {
@@ -73,7 +72,7 @@
}
/* No such GPIO */
- return ret ? ret : -ENOENT;
+ return -ENOENT;
}
#if CONFIG_IS_ENABLED(DM_GPIO_LOOKUP_LABEL)
@@ -119,12 +118,11 @@
struct udevice *dev;
ulong offset;
int numeric;
- int ret;
numeric = isdigit(*name) ? dectoul(name, NULL) : -1;
- for (ret = uclass_first_device(UCLASS_GPIO, &dev);
+ for (uclass_first_device(UCLASS_GPIO, &dev);
dev;
- ret = uclass_next_device(&dev)) {
+ uclass_next_device(&dev)) {
int len;
uc_priv = dev_get_uclass_priv(dev);
@@ -152,7 +150,7 @@
}
if (!dev)
- return ret ? ret : -EINVAL;
+ return -EINVAL;
gpio_desc_init(desc, dev, offset);