diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2020-11-13 13:08:50 +0300 |
---|---|---|
committer | Joel Stanley <joel@jms.id.au> | 2020-11-19 23:01:15 +1030 |
commit | 0f0c9c702241d839dbb1d355b77e5712a5a5793f (patch) | |
tree | b98aa8229b02cb801a6a51987a52e719f1e0df8c | |
parent | 959b981dc7bc144e0e256f8fe34b6ce23e839525 (diff) |
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: e0218dca5787 ("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>
-rw-r--r-- | drivers/soc/aspeed/aspeed-socinfo.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/soc/aspeed/aspeed-socinfo.c b/drivers/soc/aspeed/aspeed-socinfo.c index 20a1d4aeb051..773930e0cb10 100644 --- a/drivers/soc/aspeed/aspeed-socinfo.c +++ b/drivers/soc/aspeed/aspeed-socinfo.c @@ -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); |