summaryrefslogtreecommitdiff
path: root/drivers/soc/bcm/brcmstb/biuctrl.c
diff options
context:
space:
mode:
authorZhaoyang Li <lizhaoyang04@hust.edu.cn>2023-03-27 14:54:22 +0300
committerFlorian Fainelli <f.fainelli@gmail.com>2023-04-03 23:37:24 +0300
commitc3fbced9af885a6f217fd95509a613d6590916ce (patch)
tree268daf1fefa6a0485fa9b4f1095f091555d1f575 /drivers/soc/bcm/brcmstb/biuctrl.c
parent69160dd0aa6832b98d272c1a224b1aaf67cf843d (diff)
downloadlinux-c3fbced9af885a6f217fd95509a613d6590916ce.tar.xz
soc: bcm: brcmstb: biuctrl: fix of_iomap leak
Smatch reports: drivers/soc/bcm/brcmstb/biuctrl.c:291 setup_hifcpubiuctrl_regs() warn: 'cpubiuctrl_base' from of_iomap() not released on lines: 291. This is because in setup_hifcpubiuctrl_regs(), cpubiuctrl_base is not released when handle error, which may cause a leak. To fix this, iounmap is added when handle error. Fixes: 22f7a9116eba ("soc: brcmstb: Correct CPU_CREDIT_REG offset for Brahma-B53 CPUs") Signed-off-by: Zhaoyang Li <lizhaoyang04@hust.edu.cn> Reviewed-by: Dan Carpenter <error27@gmail.com> Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn> Link: https://lore.kernel.org/r/20230327115422.1536615-1-lizhaoyang04@hust.edu.cn Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Diffstat (limited to 'drivers/soc/bcm/brcmstb/biuctrl.c')
-rw-r--r--drivers/soc/bcm/brcmstb/biuctrl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/soc/bcm/brcmstb/biuctrl.c b/drivers/soc/bcm/brcmstb/biuctrl.c
index e1d7b4543248..364ddbe365c2 100644
--- a/drivers/soc/bcm/brcmstb/biuctrl.c
+++ b/drivers/soc/bcm/brcmstb/biuctrl.c
@@ -288,6 +288,10 @@ static int __init setup_hifcpubiuctrl_regs(struct device_node *np)
if (BRCM_ID(family_id) == 0x7260 && BRCM_REV(family_id) == 0)
cpubiuctrl_regs = b53_cpubiuctrl_no_wb_regs;
out:
+ if (ret && cpubiuctrl_base) {
+ iounmap(cpubiuctrl_base);
+ cpubiuctrl_base = NULL;
+ }
return ret;
}