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: e0218dca57 ("soc: aspeed: Add soc info driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
Link: https://lore.kernel.org/r/20201113100850.GA168908@mwanda
Signed-off-by: Joel Stanley <joel@jms.id.au>
This commit is contained in:
Dan Carpenter 2020-11-13 13:08:50 +03:00 committed by Joel Stanley
parent 959b981dc7
commit 0f0c9c7022

View File

@ -74,8 +74,10 @@ static int __init aspeed_socinfo_init(void)
}
reg = of_iomap(np, 0);
if (!reg)
if (!reg) {
of_node_put(np);
return -ENODEV;
}
siliconid = readl(reg);
iounmap(reg);