[PATCH v4 13/21] w1: Clean up device iteration in w1_bus_find_dev
Michal Suchanek
msuchanek at suse.de
Sun Sep 25 10:28:06 CEST 2022
The cycle is guarded by !ret && dev, code in if (ret || ! dev) is never
executed. dev implies !ret, and ret is not even checked when getting
next device, just drop the ret variable completely.
Signed-off-by: Michal Suchanek <msuchanek at suse.de>
---
drivers/w1/w1-uclass.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/w1/w1-uclass.c b/drivers/w1/w1-uclass.c
index de4f25bcf9..a4247ecd62 100644
--- a/drivers/w1/w1-uclass.c
+++ b/drivers/w1/w1-uclass.c
@@ -36,15 +36,10 @@ int w1_bus_find_dev(const struct udevice *bus, u64 id, struct udevice
{
struct udevice *dev;
u8 family = id & 0xff;
- int ret;
- for (ret = uclass_first_device(UCLASS_W1_EEPROM, &dev);
- !ret && dev;
+ for (uclass_first_device(UCLASS_W1_EEPROM, &dev);
+ dev;
uclass_next_device(&dev)) {
- if (ret || !dev) {
- debug("cannot find w1 eeprom dev\n");
- return -ENODEV;
- }
if (dev_get_driver_data(dev) == family) {
*devp = dev;
--
2.37.3
More information about the U-Boot
mailing list