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>
This commit is contained in:
David Dueck
2015-06-26 15:30:22 +02:00
committed by Stephen Boyd
parent 15ab38273d
commit c76a024e82
6 changed files with 30 additions and 10 deletions

View File

@@ -338,12 +338,16 @@ at91_clk_register_pll(struct at91_pmc *pmc, unsigned int irq, const char *name,
irq_set_status_flags(pll->irq, IRQ_NOAUTOEN);
ret = request_irq(pll->irq, clk_pll_irq_handler, IRQF_TRIGGER_HIGH,
id ? "clk-pllb" : "clk-plla", pll);
if (ret)
if (ret) {
kfree(pll);
return ERR_PTR(ret);
}
clk = clk_register(NULL, &pll->hw);
if (IS_ERR(clk))
if (IS_ERR(clk)) {
free_irq(pll->irq, pll);
kfree(pll);
}
return clk;
}