gpio: omap: do not unprepare the debounce clock twice on probe failure
Subsystems (2)
PATCH 1/1 gpio: omap: do not unprepare the debounce clock twice on probe failure
The debounce clock is now obtained with devm_clk_get_prepared(), so devres unprepares it when probe fails or the device is unbound. The error path added for a failing pm_runtime_resume_and_get() still calls clk_unprepare() on the same clock by hand.
When pm_runtime_resume_and_get() fails and a debounce clock is present, the clock is unprepared twice. The second clk_unprepare() warns that the clock is already unprepared.
Drop the manual clk_unprepare().
This issue was found by auditing the driver with an LLM coding assistant.
--- drivers/gpio/gpio-omap.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpio/gpio-omap.c +0 -2
@@ -1463,8 +1463,6 @@ static int omap_gpio_probe(struct platform_device *pdev) ret =pm_runtime_resume_and_get (dev);if (ret <0 ) {pm_runtime_disable (dev); -if (bank->dbck_flag) -clk_unprepare (bank->dbck);return ret; }
Signature · 1 line
2.25.1
Quoted 9 lines · On Tue, 24 Nov 2026 15:52:31 +0700 Cong Nguyen <[email protected]> wrote:
The debounce clock is now obtained with
devm_clk_get_prepared(), so devres unprepares it when probe fails or the device is unbound. The error path added for a failingpm_runtime_resume_and_get()still callsclk_unprepare()on the same clock by hand.When
pm_runtime_resume_and_get()fails and a debounce clock is present, the clock is unprepared twice. The secondclk_unprepare()warns that the clock is already unprepared.
Quoted 6 lines
Drop the manual
clk_unprepare().This issue was found by auditing the driver with an LLM coding assistant.
Fixes 9df982f1f283 ("gpio: omap: handle debounce clock preparation failure")Signed-off-by Cong Nguyen <[email protected]>
Quoted 17 lines
--- drivers/gpio/gpio-omap.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpio/gpio-omap.c +0
-2@@ -1463,8 +1463,6 @@ static int omap_gpio_probe(struct platform_device *pdev) ret =pm_runtime_resume_and_get (dev);if (ret <0 ) {pm_runtime_disable (dev); -if (bank->dbck_flag) -clk_unprepare (bank->dbck);return ret; }
Hi Cong,
thanks for the fix!
Quoted 9 lines · Cong Nguyen
The debounce clock is now obtained with
devm_clk_get_prepared(), so devres unprepares it when probe fails or the device is unbound. The error path added for a failingpm_runtime_resume_and_get()still callsclk_unprepare()on the same clock by hand.When
pm_runtime_resume_and_get()fails and a debounce clock is present, the clock is unprepared twice. The secondclk_unprepare()warns that the clock is already unprepared.
Quoted 6 lines
Drop the manual
clk_unprepare().This issue was found by auditing the driver with an LLM coding assistant.
Fixes 9df982f1f283 ("gpio: omap: handle debounce clock preparation failure")Signed-off-by Cong Nguyen <[email protected]>
looks correct to me,
Looks like the issue crept in because of the tight merges of 05be1a99d6d68 ("gpio: omap: Propagate runtime PM failures in probe and request"), present in v7.4-rc3 (next-20261104) and the following merge of 9df982f1f283 ("gpio: omap: handle debounce clock preparation failure") into next-20261119, which wasn't based on at least v7.4-rc3.
Quoted 17 lines
---
drivers/gpio/gpio-omap.c | 2 --1 file changed, 2 deletions(-)drivers/gpio/gpio-omap.c +0
-2@@ -1463,8 +1463,6 @@ static int omap_gpio_probe(struct platform_device *pdev) ret = pm_runtime_resume_and_get(dev); if (ret < 0) { pm_runtime_disable(dev); -if (bank->dbck_flag) -clk_unprepare (bank->dbck); return ret; }
Signature · 3 lines
Alexander Sverdlin Siemens AG www.siemens.com
Bartosz Golaszewski
AppliedQuoted 10 lines · Cong Nguyen
The debounce clock is now obtained with
devm_clk_get_prepared(), so devres unprepares it when probe fails or the device is unbound. The error path added for a failingpm_runtime_resume_and_get()still callsclk_unprepare()on the same clock by hand.When
pm_runtime_resume_and_get()fails and a debounce clock is present, the clock is unprepared twice. The secondclk_unprepare()warns that the clock is already unprepared.[...]
Applied, thanks!
[1/1] gpio: omap: do not unprepare the debounce clock twice on probe failure
https://git.kernel.org/brgl/c/b43f14590a30eeefd64e1db85f08f9ecea1821d8
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>
Bartosz Golaszewski
maintainerQuoted 5 lines · Cong Nguyen
The debounce clock is now obtained with
devm_clk_get_prepared(), so devres unprepares it when probe fails or the device is unbound. The error path added for a failingpm_runtime_resume_and_get()still callsclk_unprepare()on the same clock by hand.
Quoted 8 lines
When
pm_runtime_resume_and_get()fails and a debounce clock is present, the clock is unprepared twice. The secondclk_unprepare()warns that the clock is already unprepared.Drop the manual
clk_unprepare().This issue was found by auditing the driver with an LLM coding assistant.
I queued it but don't add things like this in the commit message. I don't care who found the issue and the consensus is the wider kernel community should not care either.
Bart