[PATCH v6 14/20] dm: pci: Update error handling in pci_sriov_init
Michal Suchanek
msuchanek at suse.de
Wed Oct 12 21:58:03 CEST 2022
Check the returned value from pci_get_bus. After a later patch
uclass_first_device_err may return a device on error and then checking
that a device is returned will not suffice.
Signed-off-by: Michal Suchanek <msuchanek at suse.de>
---
v6: - split off as separate patch
---
drivers/pci/pci-uclass.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 5cff81ac44..6dd19650f9 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -1777,10 +1777,9 @@ int pci_sriov_init(struct udevice *pdev, int vf_en)
bdf = dm_pci_get_bdf(pdev);
- pci_get_bus(PCI_BUS(bdf), &bus);
-
- if (!bus)
- return -ENODEV;
+ ret = pci_get_bus(PCI_BUS(bdf), &bus);
+ if (ret)
+ return ret;
bdf += PCI_BDF(0, 0, vf_offset);
--
2.37.3
More information about the U-Boot
mailing list