From: Dan Carpenter <dan.carpenter@oracle.com>
To: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@aj.id.au>, Tom Rix <trix@redhat.com>,
linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] soc: aspeed: Fix a reference leak in aspeed_socinfo_init()
Date: Fri, 13 Nov 2020 13:08:50 +0300 [thread overview]
Message-ID: <20201113100850.GA168908@mwanda> (raw)
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>
---
drivers/soc/aspeed/aspeed-socinfo.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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);
--
2.28.0
next reply other threads:[~2020-11-13 10:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 10:08 Dan Carpenter [this message]
2020-11-16 4:10 ` [PATCH] soc: aspeed: Fix a reference leak in aspeed_socinfo_init() Andrew Jeffery
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201113100850.GA168908@mwanda \
--to=dan.carpenter@oracle.com \
--cc=andrew@aj.id.au \
--cc=joel@jms.id.au \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=trix@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox