From: Brian Norris <computersforpeace@gmail.com>
To: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-clk@vger.kernel.org, <linux-kernel@vger.kernel.org>,
Brian Norris <computersforpeace@gmail.com>,
Jyri Sarha <jsarha@ti.com>, Sergej Sawazki <ce3a@gmx.de>
Subject: [PATCH] clk: gpio: fix memory leak in of_gpio_clk_setup()
Date: Wed, 16 Dec 2015 10:28:31 -0800 [thread overview]
Message-ID: <1450290511-14442-1-git-send-email-computersforpeace@gmail.com> (raw)
Reported by Coverity.
Fixes: f66541ba02d5 ("clk: gpio: Get parent clk names in of_gpio_clk_setup()")
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Jyri Sarha <jsarha@ti.com>
Cc: Sergej Sawazki <ce3a@gmx.de>
Cc: Stephen Boyd <sboyd@codeaurora.org>
---
drivers/clk/clk-gpio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/clk-gpio.c b/drivers/clk/clk-gpio.c
index 335322dc403f..c1baa89cbf91 100644
--- a/drivers/clk/clk-gpio.c
+++ b/drivers/clk/clk-gpio.c
@@ -294,8 +294,10 @@ static void __init of_gpio_clk_setup(struct device_node *node,
num_parents = of_clk_get_parent_count(node);
parent_names = kcalloc(num_parents, sizeof(char *), GFP_KERNEL);
- if (!parent_names)
+ if (!parent_names) {
+ kfree(data);
return;
+ }
for (i = 0; i < num_parents; i++)
parent_names[i] = of_clk_get_parent_name(node, i);
--
2.6.0.rc2.230.g3dd15c0
next reply other threads:[~2015-12-16 18:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-16 18:28 Brian Norris [this message]
2015-12-16 18:35 ` [PATCH] clk: gpio: handle error codes for of_clk_get_parent_count() Brian Norris
2016-01-01 5:57 ` Michael Turquette
2016-01-01 5:56 ` [PATCH] clk: gpio: fix memory leak in of_gpio_clk_setup() Michael Turquette
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=1450290511-14442-1-git-send-email-computersforpeace@gmail.com \
--to=computersforpeace@gmail.com \
--cc=ce3a@gmx.de \
--cc=jsarha@ti.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@codeaurora.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).