From: Yuho Choi <dbgh9129@gmail.com>
To: Linus Walleij <linusw@kernel.org>, Bartosz Golaszewski <brgl@kernel.org>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Yuho Choi <dbgh9129@gmail.com>
Subject: [PATCH v1] gpio: mvebu: Fix optional clock enable handling
Date: Tue, 7 Jul 2026 12:00:30 -0400 [thread overview]
Message-ID: <20260707160030.385137-1-dbgh9129@gmail.com> (raw)
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. Reject PWM
setup when the optional clock is absent.
Fixes: de88747f514a ("gpio: mvebu: Add clk support to prevent lockup")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
---
drivers/gpio/gpio-mvebu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index c030d1f00abc..c63cdaa78ac1 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -1152,10 +1152,10 @@ 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
next reply other threads:[~2026-07-07 16:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 16:00 Yuho Choi [this message]
2026-07-08 11:53 ` [PATCH v1] gpio: mvebu: Fix optional clock enable handling Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260707160030.385137-1-dbgh9129@gmail.com \
--to=dbgh9129@gmail.com \
--cc=brgl@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox