clocksource/drivers/fsl_ftm_timer: Unmap region obtained by of_iomap
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Tue, 20 Jun 2017 11:03:30 +0000 (16:33 +0530)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 27 Jun 2017 09:25:39 +0000 (11:25 +0200)
In case of error at init time, rollback iomapping.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/clocksource/fsl_ftm_timer.c

index 3121e2d96c91b1beeaa6cb25d9ffb4802c4fcb78..3ee7e6fea6212668d8a9a4d4c1e5c52aedab58fb 100644 (file)
@@ -329,13 +329,13 @@ static int __init ftm_timer_init(struct device_node *np)
        priv->clkevt_base = of_iomap(np, 0);
        if (!priv->clkevt_base) {
                pr_err("ftm: unable to map event timer registers\n");
-               goto err;
+               goto err_clkevt;
        }
 
        priv->clksrc_base = of_iomap(np, 1);
        if (!priv->clksrc_base) {
                pr_err("ftm: unable to map source timer registers\n");
-               goto err;
+               goto err_clksrc;
        }
 
        ret = -EINVAL;
@@ -366,6 +366,10 @@ static int __init ftm_timer_init(struct device_node *np)
        return 0;
 
 err:
+       iounmap(priv->clksrc_base);
+err_clksrc:
+       iounmap(priv->clkevt_base);
+err_clkevt:
        kfree(priv);
        return ret;
 }