]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
PCI: brcmstb: Fix error path after a call to regulator_bulk_get()
authorJim Quinlan <james.quinlan@broadcom.com>
Fri, 14 Feb 2025 17:39:32 +0000 (12:39 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:33:32 +0000 (14:33 +0200)
commit99a0efba9f903acbdece548862b6b4cbe7d999e1
treed1684dd8abca2fee74ef58da2ae75ff5b6cb95d9
parent5bb237a1f62b574bcd478fd905abafcebf137d38
PCI: brcmstb: Fix error path after a call to regulator_bulk_get()

[ Upstream commit 3651ad5249c51cf7eee078e12612557040a6bdb4 ]

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: 9e6be018b263 ("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>
Link: https://lore.kernel.org/r/20250214173944.47506-5-james.quinlan@broadcom.com
[kwilczynski: commit log, use comma in the message to match style with
other similar messages]
Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/controller/pcie-brcmstb.c