diff options
author | Michal Suchanek <msuchanek@suse.de> | 2022-10-12 21:58:08 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2022-10-29 07:36:33 -0600 |
commit | 4954937d922840c212b7eba297cc2d4779f087ad (patch) | |
tree | 7176fea63bf97553b10dbc57b225886476f81309 /drivers/pci | |
parent | aa5511e77b8bd8f943c66b6403896d06083b1d92 (diff) | |
download | u-boot-4954937d922840c212b7eba297cc2d4779f087ad.tar.gz u-boot-4954937d922840c212b7eba297cc2d4779f087ad.tar.bz2 u-boot-4954937d922840c212b7eba297cc2d4779f087ad.zip |
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>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pci-uclass.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 6dd19650f9..9343cfc62a 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -1211,7 +1211,6 @@ static int pci_bridge_write_config(struct udevice *bus, pci_dev_t bdf, static int skip_to_next_device(struct udevice *bus, struct udevice **devp) { struct udevice *dev; - int ret = 0; /* * Scan through all the PCI controllers. On x86 there will only be one @@ -1223,9 +1222,7 @@ static int skip_to_next_device(struct udevice *bus, struct udevice **devp) *devp = dev; return 0; } - ret = uclass_next_device(&bus); - if (ret) - return ret; + uclass_next_device(&bus); } return 0; @@ -1235,7 +1232,6 @@ int pci_find_next_device(struct udevice **devp) { struct udevice *child = *devp; struct udevice *bus = child->parent; - int ret; /* First try all the siblings */ *devp = NULL; @@ -1248,9 +1244,7 @@ int pci_find_next_device(struct udevice **devp) } /* We ran out of siblings. Try the next bus */ - ret = uclass_next_device(&bus); - if (ret) - return ret; + uclass_next_device(&bus); return bus ? skip_to_next_device(bus, devp) : 0; } @@ -1258,12 +1252,9 @@ int pci_find_next_device(struct udevice **devp) int pci_find_first_device(struct udevice **devp) { struct udevice *bus; - int ret; *devp = NULL; - ret = uclass_first_device(UCLASS_PCI, &bus); - if (ret) - return ret; + uclass_first_device(UCLASS_PCI, &bus); return skip_to_next_device(bus, devp); } |