Skip to content

Commit 5a8dc12

Browse files
jamesequinlanpopcornmix
authored andcommitted
PCI: brcmstb: Fix error path upon call of regulator_bulk_get()
If regulator_bulk_get() returns an error, no regulators are created and we need to set their number to zero. If we do not do this and the PCIe link-up fails, regulator_bulk_free() will be invoked and effect a panic. Also print out the error value, as we cannot return an error upwards as Linux will WARN on an error from add_bus(). Fixes: 9e6be01 ("PCI: brcmstb: Enable child bus device regulators from DT") Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
1 parent 14035ff commit 5a8dc12

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/pci/controller/pcie-brcmstb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,8 @@ static int brcm_pcie_add_bus(struct pci_bus *bus)
14161416

14171417
ret = regulator_bulk_get(dev, sr->num_supplies, sr->supplies);
14181418
if (ret) {
1419-
dev_info(dev, "No regulators for downstream device\n");
1419+
dev_info(dev, "Did not get regulators; err=%d\n", ret);
1420+
pcie->sr = NULL;
14201421
goto no_regulators;
14211422
}
14221423

0 commit comments

Comments
 (0)