clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Fri, 8 Nov 2013 10:07:59 +0000 (11:07 +0100)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Wed, 20 Nov 2013 20:55:21 +0000 (21:55 +0100)
Fix the probe error path to release the clock resource when the
sh_mtu2_register() call fails.

Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/clocksource/sh_mtu2.c

index 4aac9ee0d0c054a7ba953b17ac3272946af7b47d..e6cfb328eb2e16e5b0681ff7a82ec3627f2d002a 100644 (file)
@@ -313,8 +313,15 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
                goto err1;
        }
 
-       return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
-                               cfg->clockevent_rating);
+       ret = sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
+                              cfg->clockevent_rating);
+       if (ret < 0)
+               goto err2;
+
+       return 0;
+
+ err2:
+       clk_put(p->clk);
  err1:
        iounmap(p->mapbase);
  err0: