Skip to content

Commit

Permalink
pci: Fix device_find_first_child() return value handling
Browse files Browse the repository at this point in the history
This function only ever returns 0, but may not assign the second
parameter. Same thing for device_find_next_child(). Do not assign
ret to stop proliferation of this misuse.

Reported-by: Jonas Karlman <[email protected]>
Signed-off-by: Marek Vasut <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
  • Loading branch information
Marek Vasut authored and trini committed Aug 14, 2023
1 parent b99c635 commit 8ee830d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/pci/pci-uclass.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,14 +541,13 @@ int pci_auto_config_devices(struct udevice *bus)
struct pci_child_plat *pplat;
unsigned int sub_bus;
struct udevice *dev;
int ret;

sub_bus = dev_seq(bus);
debug("%s: start\n", __func__);
pciauto_config_init(hose);
for (ret = device_find_first_child(bus, &dev);
!ret && dev;
ret = device_find_next_child(&dev)) {
for (device_find_first_child(bus, &dev);
dev;
device_find_next_child(&dev)) {
unsigned int max_bus;
int ret;

Expand Down

0 comments on commit 8ee830d

Please sign in to comment.