From: David Dueck <davidcdueck@googlemail.com>
To: boris.brezillon@free-electrons.com
Cc: mturquette@linaro.org, nicolas.ferre@atmel.com,
sboyd@codeaurora.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/6] clk: at91: clk-master: fix error path
Date: Fri, 26 Jun 2015 14:33:29 +0200 [thread overview]
Message-ID: <1435322012-5667-3-git-send-email-davidcdueck@googlemail.com> (raw)
In-Reply-To: <1435322012-5667-1-git-send-email-davidcdueck@googlemail.com>
Do not leak memory if request_irq fails and free the irq if
clk_register fails.
Signed-off-by: David Dueck <davidcdueck@googlemail.com>
---
drivers/clk/at91/clk-master.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c
index c1af80b..d7d6c59 100644
--- a/drivers/clk/at91/clk-master.c
+++ b/drivers/clk/at91/clk-master.c
@@ -165,12 +165,16 @@ at91_clk_register_master(struct at91_pmc *pmc, unsigned int irq,
irq_set_status_flags(master->irq, IRQ_NOAUTOEN);
ret = request_irq(master->irq, clk_master_irq_handler,
IRQF_TRIGGER_HIGH, "clk-master", master);
- if (ret)
+ if (ret) {
+ kfree(master);
return ERR_PTR(ret);
+ }
clk = clk_register(NULL, &master->hw);
- if (IS_ERR(clk))
+ if (IS_ERR(clk)) {
+ free_irq(master->irq, master);
kfree(master);
+ }
return clk;
}
--
2.4.4
next prev parent reply other threads:[~2015-06-26 12:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-26 12:33 [PATCH 1/6] clk: at91: clk-h32mxclk: fix memory leak David Dueck
2015-06-26 12:33 ` [PATCH 2/6] clk: at91: clk-main: " David Dueck
2015-06-26 12:33 ` David Dueck [this message]
2015-06-26 12:33 ` [PATCH 4/6] clk: at91: clk-pll: fix error path David Dueck
2015-06-26 12:33 ` [PATCH 5/6] clk: at91: clk-system: " David Dueck
2015-06-26 12:33 ` [PATCH 6/6] clk: at91: clk-utmi: " David Dueck
2015-06-26 13:12 ` [PATCH 1/6] clk: at91: clk-h32mxclk: fix memory leak Boris Brezillon
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=1435322012-5667-3-git-send-email-davidcdueck@googlemail.com \
--to=davidcdueck@googlemail.com \
--cc=boris.brezillon@free-electrons.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@linaro.org \
--cc=nicolas.ferre@atmel.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