Skip to contentSkip to conversation

soc: brcmstb: Fix error path for unsupported CPUs

PATCH Applied Florian Fainelli 1 participant 2 messages Apr 7, 2019 – Apr 17, 2019 Broadcom BCM7XXX Arm architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: brcmstb: Fix error path for unsupported CPUs

In case setup_hifcpubiuctrl_regs() returns an error, because of e.g:
an unsupported CPU type, just catch that error and return instead of blindly continuing with the initialization. This fixes a NULL pointer de-reference with the code continuing without having a proper array of registers to use.

Fixes 22f7a9116eba ("soc: brcmstb: Correct CPU_CREDIT_REG offset for Brahma-B53 CPUs")
---
 drivers/soc/bcm/brcmstb/biuctrl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/soc/bcm/brcmstb/biuctrl.c +3 -1
index 6d89ebf13b8a..c16273b31b94 100644
@@ -246,7 +246,9 @@ static int __init brcmstb_biuctrl_init(void)
 	if (!np)
 		return 0;
 
-	setup_hifcpubiuctrl_regs(np);
+	ret = setup_hifcpubiuctrl_regs(np);
+	if (ret)
+		return ret;
 
 	ret = mcp_write_pairing_set();
 	if (ret) {
Signature · 1 line
2.17.1
author Applied
#1 lore raw
Quoted 9 lines · Florian Fainelli

In case setup_hifcpubiuctrl_regs() returns an error, because of e.g:
an unsupported CPU type, just catch that error and return instead of blindly continuing with the initialization. This fixes a NULL pointer de-reference with the code continuing without having a proper array of registers to use.

Fixes 22f7a9116eba ("soc: brcmstb: Correct CPU_CREDIT_REG offset for Brahma-B53 CPUs")

---

Applied to soc/fixes, thanks!
--
Florian