[PATCH 01/12] clocksource: sh_cmt: Take care of clk_put() when setup_irq() fails

Simon Horman horms+renesas at verge.net.au
Mon Mar 18 09:02:27 EDT 2013


From: Magnus Damm <damm at opensource.se>

Make sure clk_put() is called in case of failure in sh_cmt_setup().

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px at renesas.com>
Signed-off-by: Magnus Damm <damm at opensource.se>
Acked-by: John Stultz <john.stultz at linaro.org>
Tested-by: Guennadi Liakhovetski <g.liakhovetski at gmx.de>
Signed-off-by: Simon Horman <horms+renesas at verge.net.au>
---
 drivers/clocksource/sh_cmt.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 488c14c..4b8d296 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -708,17 +708,19 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
 			      cfg->clocksource_rating);
 	if (ret) {
 		dev_err(&p->pdev->dev, "registration failed\n");
-		goto err1;
+		goto err2;
 	}
 	p->cs_enabled = false;
 
 	ret = setup_irq(irq, &p->irqaction);
 	if (ret) {
 		dev_err(&p->pdev->dev, "failed to request irq %d\n", irq);
-		goto err1;
+		goto err2;
 	}
 
 	return 0;
+err2:
+	clk_put(p->clk);
 
 err1:
 	iounmap(p->mapbase);
-- 
1.7.10.4




More information about the linux-arm-kernel mailing list