Skip to content

Commit 3651ad5

Browse files
jamesequinlankwilczynski
authored andcommitted
PCI: brcmstb: Fix error path after a call to regulator_bulk_get()
If the regulator_bulk_get() returns an error and no regulators are created, we need to set their number to zero. If we don't do this and the PCIe link up fails, a call to the regulator_bulk_free() will result in a kernel panic. While at it, print the error value, as we cannot return an error upwards as the kernel will WARN() on an error from add_bus(). Fixes: 9e6be01 ("PCI: brcmstb: Enable child bus device regulators from DT") Signed-off-by: Jim Quinlan <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/[email protected] [kwilczynski: commit log, use comma in the message to match style with other similar messages] Signed-off-by: Krzysztof Wilczyński <[email protected]>
1 parent b5e4417 commit 3651ad5

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)