drivers/gpio/gpio-mvebu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
mvebu_gpio_probe() ignores clk_prepare_enable() failures and has no
matching disable path for later probe failures.
Use devm_clk_get_optional_enabled() so clock lookup and enable failures
are reported, and so devres disables the clock on cleanup.
Fixes: de88747f514a ("gpio: mvebu: Add clk support to prevent lockup")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
---
drivers/gpio/gpio-mvebu.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index a010604e5ff7..095881603b75 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -1153,10 +1153,11 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
return id;
}
- mvchip->clk = devm_clk_get(&pdev->dev, NULL);
+ mvchip->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
/* Not all SoCs require a clock.*/
- if (!IS_ERR(mvchip->clk))
- clk_prepare_enable(mvchip->clk);
+
+ if (IS_ERR(mvchip->clk))
+ return PTR_ERR(mvchip->clk);
mvchip->soc_variant = soc_variant;
mvchip->chip.label = dev_name(&pdev->dev);
--
2.43.0
On Sun, 2 Aug 2026 00:10:08 +0200, Yuho Choi <dbgh9129@gmail.com> said:
> mvebu_gpio_probe() ignores clk_prepare_enable() failures and has no
> matching disable path for later probe failures.
>
> Use devm_clk_get_optional_enabled() so clock lookup and enable failures
> are reported, and so devres disables the clock on cleanup.
>
> Fixes: de88747f514a ("gpio: mvebu: Add clk support to prevent lockup")
>
No blank line here please.
> Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
You should also explain that the binding for this chip does not describe the
clocks as required so using the optional variant is actually a fix as well.
Bart
> ---
> drivers/gpio/gpio-mvebu.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
> index a010604e5ff7..095881603b75 100644
> --- a/drivers/gpio/gpio-mvebu.c
> +++ b/drivers/gpio/gpio-mvebu.c
> @@ -1153,10 +1153,11 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
> return id;
> }
>
> - mvchip->clk = devm_clk_get(&pdev->dev, NULL);
> + mvchip->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
> /* Not all SoCs require a clock.*/
> - if (!IS_ERR(mvchip->clk))
> - clk_prepare_enable(mvchip->clk);
> +
> + if (IS_ERR(mvchip->clk))
> + return PTR_ERR(mvchip->clk);
>
> mvchip->soc_variant = soc_variant;
> mvchip->chip.label = dev_name(&pdev->dev);
> --
> 2.43.0
>
>
© 2016 - 2026 Red Hat, Inc.