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>,
linux-omap@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] gpio: omap: handle clk_prepare failure in probe
Date: Tue, 18 Aug 2026 17:08:54 +0400 [thread overview]
Message-ID: <tencent_B4F504456790E8BA3C4EAB80F4BFB6954E08@qq.com> (raw)
omap_gpio_probe() ignores the return value of clk_prepare(bank->dbck).
If clk_prepare fails, the clock is not prepared, but bank->dbck_flag
remains true. Later, omap_gpio_remove() or the probe error path calls
clk_unprepare(bank->dbck) unconditionally when dbck_flag is true,
leading to an unbalanced clock operation.
Check the return value of clk_prepare in omap_gpio_probe. On failure,
clear dbck_flag and return the error, preventing unbalanced
clk_unprepare in remove or error paths.
Signed-off-by: jiawen <1298662399@qq.com>
---
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1462,7 +1462,12 @@
"Could not get gpio dbck. Disable debounce\n");
bank->dbck_flag = false;
} else {
- clk_prepare(bank->dbck);
+ ret = clk_prepare(bank->dbck);
+ if (ret) {
+ dev_err(dev, "Could not prepare gpio dbck\n");
+ bank->dbck_flag = false;
+ return ret;
+ }
}
}
next reply other threads:[~2026-08-18 13:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 13:08 Jiawen Liu [this message]
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 ` [PATCH v2] gpio: omap: handle debounce clock preparation failure Jiawen Liu
2026-11-10 13:02 ` 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_B4F504456790E8BA3C4EAB80F4BFB6954E08@qq.com \
--to=1298662399@qq.com \
--cc=brgl@kernel.org \
--cc=grygorii.strashko@ti.com \
--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=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®