From: Nishka Dasgupta <nishkadg.linux@gmail.com>
To: mturquette@baylibre.com, sboyd@kernel.org,
linux-clk@vger.kernel.org, linus.walleij@linaro.org,
linux-arm-kernel@lists.infradead.org
Cc: Nishka Dasgupta <nishkadg.linux@gmail.com>
Subject: [PATCH] clk: versatile: Add of_node_put() in cm_osc_setup()
Date: Sun, 4 Aug 2019 22:04:44 +0530 [thread overview]
Message-ID: <20190804163445.6862-1-nishkadg.linux@gmail.com> (raw)
In function cm_osc_setup, variable parent takes the value returned by
of_get_parent, which gets a node but does not put it. If parent is not
put before it goes out of scope, it may cause a memory leak.
Hence put parent before the function terminates.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/clk/versatile/clk-versatile.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clk/versatile/clk-versatile.c b/drivers/clk/versatile/clk-versatile.c
index 90bb0b041b7a..fd54d5c0251c 100644
--- a/drivers/clk/versatile/clk-versatile.c
+++ b/drivers/clk/versatile/clk-versatile.c
@@ -70,6 +70,7 @@ static void __init cm_osc_setup(struct device_node *np,
return;
}
cm_base = of_iomap(parent, 0);
+ of_node_put(parent);
if (!cm_base) {
pr_err("could not remap core module base\n");
return;
--
2.19.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2019-08-04 16:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-04 16:34 Nishka Dasgupta [this message]
2019-08-06 12:53 ` [PATCH] clk: versatile: Add of_node_put() in cm_osc_setup() Linus Walleij
2019-08-07 22:25 ` Stephen Boyd
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=20190804163445.6862-1-nishkadg.linux@gmail.com \
--to=nishkadg.linux@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).