Skip to content

Commit c3fbced

Browse files
Zhaoyang Liffainelli
authored andcommitted
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: 22f7a91 ("soc: brcmstb: Correct CPU_CREDIT_REG offset for Brahma-B53 CPUs") Signed-off-by: Zhaoyang Li <[email protected]> Reviewed-by: Dan Carpenter <[email protected]> Reviewed-by: Dongliang Mu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Florian Fainelli <[email protected]>
1 parent 69160dd commit c3fbced

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/soc/bcm/brcmstb/biuctrl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,10 @@ static int __init setup_hifcpubiuctrl_regs(struct device_node *np)
288288
if (BRCM_ID(family_id) == 0x7260 && BRCM_REV(family_id) == 0)
289289
cpubiuctrl_regs = b53_cpubiuctrl_no_wb_regs;
290290
out:
291+
if (ret && cpubiuctrl_base) {
292+
iounmap(cpubiuctrl_base);
293+
cpubiuctrl_base = NULL;
294+
}
291295
return ret;
292296
}
293297

0 commit comments

Comments
 (0)