mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] soc: brcmstb: Fix error path for unsupported CPUs
@ 2019-04-07 21:19 Florian Fainelli
  2019-04-17 18:56 ` Florian Fainelli
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2019-04-07 21:19 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Florian Fainelli, Brian Norris, Gregory Fong,
	maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE, open list

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")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/soc/bcm/brcmstb/biuctrl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/bcm/brcmstb/biuctrl.c b/drivers/soc/bcm/brcmstb/biuctrl.c
index 6d89ebf13b8a..c16273b31b94 100644
--- a/drivers/soc/bcm/brcmstb/biuctrl.c
+++ b/drivers/soc/bcm/brcmstb/biuctrl.c
@@ -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) {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] soc: brcmstb: Fix error path for unsupported CPUs
  2019-04-07 21:19 [PATCH] soc: brcmstb: Fix error path for unsupported CPUs Florian Fainelli
@ 2019-04-17 18:56 ` Florian Fainelli
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2019-04-17 18:56 UTC (permalink / raw)
  To: bcm-kernel-feedback-list, linux-arm-kernel
  Cc: Brian Norris, Gregory Fong, open list

On Sun,  7 Apr 2019 14:19:07 -0700, Florian Fainelli <f.fainelli@gmail.com> wrote:
> 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")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---

Applied to soc/fixes, thanks!
--
Florian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-17 18:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-07 21:19 [PATCH] soc: brcmstb: Fix error path for unsupported CPUs Florian Fainelli
2019-04-17 18:56 ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®