Skip to content

Commit

Permalink
pinctrl: plgpio: Call clk_disable_unprepare only if clk_prepare_enabl…
Browse files Browse the repository at this point in the history
…e is called

This driver allows clk_get() failure, and still work without it.
This patch adds !IS_ERR(plgpio->clk) checking in plgpio_request() error path
so we only call clk_disable_unprepare() if clk_prepare_enable() is called.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Axel Lin authored and Linus Walleij committed Nov 15, 2012
1 parent 6f37b1b commit 9804049
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/pinctrl/spear/pinctrl-plgpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ static int plgpio_request(struct gpio_chip *chip, unsigned offset)
return 0;

err1:
clk_disable_unprepare(plgpio->clk);
if (!IS_ERR(plgpio->clk))
clk_disable_unprepare(plgpio->clk);
err0:
pinctrl_free_gpio(gpio);
return ret;
Expand Down

0 comments on commit 9804049

Please sign in to comment.