diff options
author | David Dueck <davidcdueck@googlemail.com> | 2015-06-26 15:30:22 +0200 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2015-07-02 18:51:50 +0200 |
commit | c76a024e82bdb83a0f7d57e006f8e7f8ddf983e5 (patch) | |
tree | 3fbd028af32dd69f1fea0a5fe36dd3c3db26ade8 /drivers/clk/at91/clk-master.c | |
parent | clk: stm32: Fix out-by-one error path in the index lookup (diff) | |
download | linux-c76a024e82bdb83a0f7d57e006f8e7f8ddf983e5.tar.xz linux-c76a024e82bdb83a0f7d57e006f8e7f8ddf983e5.zip |
clk: at91: do not leak resources
Do not leak memory and free irqs in case of an error.
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: David Dueck <davidcdueck@googlemail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/at91/clk-master.c')
-rw-r--r-- | drivers/clk/at91/clk-master.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c index f98eafe9b12d..5b3ded5205a2 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; } |