Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: cdnsp: drop runtime PM reference on gadget init failure
@ 2026-11-04  2:15 Wentao Liang
  2026-11-04  2:30 ` sashiko-bot
  2026-11-04  8:03 ` Peter Chen
  0 siblings, 2 replies; 6+ messages in thread
From: Wentao Liang @ 2026-11-04  2:15 UTC (permalink / raw)
  To: Pawel Laszczak, Greg Kroah-Hartman; +Cc: linux-usb

__cdnsp_gadget_init() takes a runtime PM reference with
pm_runtime_get_sync().  On success the reference is dropped by
cdnsp_gadget_exit(), which the role core only calls once the role state
has been set to active.  The failure paths return before that, so the
reference is leaked.

Drop the reference on the common error path.

Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/usb/cdns3/cdnsp-gadget.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c
index e84405352caa..d3df4bc4a17b 100644
--- a/drivers/usb/cdns3/cdnsp-gadget.c
+++ b/drivers/usb/cdns3/cdnsp-gadget.c
@@ -2083,6 +2083,7 @@ static int __cdnsp_gadget_init(struct cdns *cdns)
 free_setup:
 	kfree(pdev->setup_buf);
 free_pdev:
+	pm_runtime_put_autosuspend(cdns->dev);
 	kfree(pdev);
 
 	return ret;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-04 10:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04  2:15 [PATCH] usb: cdnsp: drop runtime PM reference on gadget init failure Wentao Liang
2026-11-04  2:30 ` sashiko-bot
2026-11-04  8:03 ` Peter Chen
2026-11-04  8:33   ` Krzysztof Kozlowski
2026-11-04 10:14     ` Peter Chen
2026-11-04 10:18   ` Peter Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox