Commit 0f0c9c70 authored by Dan Carpenter's avatar Dan Carpenter Committed by Joel Stanley

soc: aspeed: Fix a reference leak in aspeed_socinfo_init()

This needs to call of_node_put(np) before returning if of_iomap() fails.

Fixes: e0218dca ("soc: aspeed: Add soc info driver")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarAndrew Jeffery <andrew@aj.id.au>
Link: https://lore.kernel.org/r/20201113100850.GA168908@mwandaSigned-off-by: default avatarJoel Stanley <joel@jms.id.au>
parent 959b981d
...@@ -74,8 +74,10 @@ static int __init aspeed_socinfo_init(void) ...@@ -74,8 +74,10 @@ static int __init aspeed_socinfo_init(void)
} }
reg = of_iomap(np, 0); reg = of_iomap(np, 0);
if (!reg) if (!reg) {
of_node_put(np);
return -ENODEV; return -ENODEV;
}
siliconid = readl(reg); siliconid = readl(reg);
iounmap(reg); iounmap(reg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment