diff mbox series

[-next] gpio: pxa: Add missing clk_disable_unprepare() in pxa_gpio_probe()

Message ID 20220704130323.104294-1-yuancan@huawei.com
State New
Headers show
Series [-next] gpio: pxa: Add missing clk_disable_unprepare() in pxa_gpio_probe() | expand

Commit Message

Yuan Can July 4, 2022, 1:03 p.m. UTC
Add clk_disable_unprepare() on error path in pxa_gpio_probe().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
 drivers/gpio/gpio-pxa.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Bartosz Golaszewski July 5, 2022, 5:18 p.m. UTC | #1
On Mon, Jul 4, 2022 at 3:05 PM Yuan Can <yuancan@huawei.com> wrote:
>
> Add clk_disable_unprepare() on error path in pxa_gpio_probe().
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
>  drivers/gpio/gpio-pxa.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
> index c7fbfa3ae43b..08963975dd1b 100644
> --- a/drivers/gpio/gpio-pxa.c
> +++ b/drivers/gpio/gpio-pxa.c
> @@ -676,6 +676,7 @@ static int pxa_gpio_probe(struct platform_device *pdev)
>         /* Initialize GPIO chips */
>         ret = pxa_init_gpio_chip(pchip, pxa_last_gpio + 1, gpio_reg_base);
>         if (ret) {
> +               clk_disable_unprepare(clk);
>                 clk_put(clk);
>                 return ret;
>         }
> --
> 2.17.1
>

Hi Yuan!

This patch is not wrong but it's incomplete. A quick glance at the
driver is telling me that once probe succeeded, nobody ever disables
or releases the clock on remove. There's no remove callback and no
devm action set for that. Please take a look at the patch I just sent.

Bart
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index c7fbfa3ae43b..08963975dd1b 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -676,6 +676,7 @@  static int pxa_gpio_probe(struct platform_device *pdev)
 	/* Initialize GPIO chips */
 	ret = pxa_init_gpio_chip(pchip, pxa_last_gpio + 1, gpio_reg_base);
 	if (ret) {
+		clk_disable_unprepare(clk);
 		clk_put(clk);
 		return ret;
 	}