From: Jiawen Liu <1298662399@qq.com>
To: Grygorii Strashko <grygorii.strashko@ti.com>,
Santosh Shilimkar <ssantosh@kernel.org>,
Kevin Hilman <khilman@kernel.org>,
Linus Walleij <linusw@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>
Cc: linux-omap@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org,
Andreas Kemnade <andreas@kemnade.info>,
Dan Carpenter <error27@gmail.com>,
Markus Elfring <Markus.Elfring@web.de>,
kernel-janitors@vger.kernel.org,
Alexander Sverdlin <alexander.sverdlin@siemens.com>,
Matti Vaittinen <mazziesaccount@gmail.com>,
Jiawen Liu <1298662399@qq.com>
Subject: [PATCH v2] gpio: omap: handle debounce clock preparation failure
Date: Mon, 9 Nov 2026 17:42:04 +0400 [thread overview]
Message-ID: <tencent_D8A4B6EE90931660EB6F586543FD58110E06@qq.com> (raw)
In-Reply-To: <tencent_B4F504456790E8BA3C4EAB80F4BFB6954E08@qq.com>
omap_gpio_probe() ignores the return value of clk_prepare() for the
debounce clock. If preparation fails, the driver still treats debounce as
available and may use or unprepare a clock that was not prepared.
Use devm_clk_get_prepared() and disable debounce if the clock cannot be
obtained or prepared. This keeps the existing behavior for clock lookup
failures. Remove both manual clk_unprepare() calls because the managed
clock is released on probe failure and device removal.
An earlier managed-clock conversion was dropped after a reported boot
failure. A follow-up removing the two manual unprepare calls was reported
to restore boot. This change also removes those calls.
Built gpio-omap.o with ARM multi_v7_defconfig and Clang 19; the current
patch has not been tested on OMAP hardware.
The original report was generated using BMC-Agent; source review and
maintainer feedback informed this revision.
Fixes: 5d9452e7c52a ("gpio: omap: fix clk_prepare/unprepare usage")
Suggested-by: Andreas Kemnade <andreas@kemnade.info>
Link: https://lore.kernel.org/r/tencent_B4F504456790E8BA3C4EAB80F4BFB6954E08@qq.com
Link: https://lkml.rescloud.iu.edu/hypermail/linux/kernel/2412.2/00414.html
Signed-off-by: Jiawen Liu <1298662399@qq.com>
---
Changes in v2:
- Use devm_clk_get_prepared() and remove both manual unprepare calls.
- Disable debounce on prepare failure, retaining clock-get failure behavior.
- Add the Fixes tag and describe the earlier managed-clock attempt.
Built with ARCH=arm, LLVM=-19, multi_v7_defconfig, W=1 and
CONFIG_GPIO_OMAP=y. No OMAP hardware test or current reproducer is available.
drivers/gpio/gpio-omap.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index a9734b2a1..314bbb48e 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1446,13 +1446,11 @@ static int omap_gpio_probe(struct platform_device *pdev)
}
if (bank->dbck_flag) {
- bank->dbck = devm_clk_get(dev, "dbclk");
+ bank->dbck = devm_clk_get_prepared(dev, "dbclk");
if (IS_ERR(bank->dbck)) {
dev_err(dev,
- "Could not get gpio dbck. Disable debounce\n");
+ "Could not get or prepare gpio dbck. Disable debounce\n");
bank->dbck_flag = false;
- } else {
- clk_prepare(bank->dbck);
}
}
@@ -1470,8 +1468,6 @@ static int omap_gpio_probe(struct platform_device *pdev)
if (ret) {
pm_runtime_put_sync(dev);
pm_runtime_disable(dev);
- if (bank->dbck_flag)
- clk_unprepare(bank->dbck);
return ret;
}
@@ -1492,8 +1488,6 @@ static void omap_gpio_remove(struct platform_device *pdev)
cpu_pm_unregister_notifier(&bank->nb);
gpiochip_remove(&bank->chip);
pm_runtime_disable(&pdev->dev);
- if (bank->dbck_flag)
- clk_unprepare(bank->dbck);
}
static int omap_gpio_runtime_suspend(struct device *dev)
--
2.34.1
next prev parent reply other threads:[~2026-11-09 13:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 13:08 [PATCH] gpio: omap: handle clk_prepare failure in probe Jiawen Liu
2026-08-20 9:19 ` Markus Elfring
2026-08-20 9:48 ` Andreas Kemnade
2026-08-20 10:47 ` Markus Elfring
2026-08-20 13:43 ` Andreas Kemnade
2026-11-08 17:22 ` [PATCH] " Jiawen Liu
2026-11-09 5:47 ` Dan Carpenter
2026-11-09 9:08 ` Bartosz Golaszewski
2026-11-09 9:18 ` Markus Elfring
2026-08-20 12:25 ` [PATCH] " Andreas Kemnade
2026-11-09 13:42 ` Jiawen Liu [this message]
2026-11-10 13:02 ` [PATCH v2] gpio: omap: handle debounce clock preparation failure Sverdlin, Alexander
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=tencent_D8A4B6EE90931660EB6F586543FD58110E06@qq.com \
--to=1298662399@qq.com \
--cc=Markus.Elfring@web.de \
--cc=alexander.sverdlin@siemens.com \
--cc=andreas@kemnade.info \
--cc=brgl@kernel.org \
--cc=error27@gmail.com \
--cc=grygorii.strashko@ti.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=khilman@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=mazziesaccount@gmail.com \
--cc=ssantosh@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
all inboxes | Powered by JetHome®