[PATCH] usb: cdnsp: Fix runtime PM reference leak in __cdnsp_gadget_init()
From: Wentao Liang
Date: Thu Sep 17 2026 - 13:05:21 EST
__cdnsp_gadget_init() takes a runtime PM reference with
pm_runtime_get_sync(), which is only released by cdnsp_gadget_exit().
If the initialization fails after the get, the role is never marked
active, so cdns_role_stop() does not call the ->stop callback and the
reference is leaked.
Drop the reference on the error path as well.
Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
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 6b3815f8a6e5..53c395631955 100644
--- a/drivers/usb/cdns3/cdnsp-gadget.c
+++ b/drivers/usb/cdns3/cdnsp-gadget.c
@@ -1990,6 +1990,7 @@ static int __cdnsp_gadget_init(struct cdns *cdns)
kfree(pdev->setup_buf);
free_pdev:
kfree(pdev);
+ pm_runtime_put_autosuspend(cdns->dev);
return ret;
}
--
2.34.1