[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1398197679-4149-1-git-send-email-colin.king@canonical.com>
Date: Tue, 22 Apr 2014 21:14:39 +0100
From: Colin King <colin.king@...onical.com>
To: Mike Turquette <mturquette@...aro.org>,
Gabriel FERNANDEZ <gabriel.fernandez@...com>,
Pankaj Dev <pankaj.dev@...com>, linux-kernel@...r.kernel.org
Subject: [PATCH] clk: st: fix memory leak on gate
From: Colin Ian King <colin.king@...onical.com>
cppcheck detected a memory leak:
[drivers/clk/st/clkgen-pll.c:525]: (error) Memory leak: gate
free gate on div allocation failure return path.
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
drivers/clk/st/clkgen-pll.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/st/clkgen-pll.c b/drivers/clk/st/clkgen-pll.c
index bca0a0b..a886702 100644
--- a/drivers/clk/st/clkgen-pll.c
+++ b/drivers/clk/st/clkgen-pll.c
@@ -521,8 +521,10 @@ static struct clk * __init clkgen_odf_register(const char *parent_name,
gate->lock = odf_lock;
div = kzalloc(sizeof(*div), GFP_KERNEL);
- if (!div)
+ if (!div) {
+ kfree(gate);
return ERR_PTR(-ENOMEM);
+ }
div->flags = CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO;
div->reg = reg + pll_data->odf[odf].offset;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists