Skip to content

Commit

Permalink
clocksource/drivers/fsl_ftm_timer: Unmap region obtained by of_iomap
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Arvind Yadav authored and Daniel Lezcano committed Jun 27, 2017
1 parent 6ec8be2 commit b70957f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/clocksource/fsl_ftm_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit b70957f

Please sign in to comment.