@@ -2820,7 +2820,7 @@ static int renesas_usb3_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);
ret = usb_add_gadget_udc(&pdev->dev, &usb3->gadget);
if (ret < 0)
- goto err_add_udc;
+ goto err_pm_disable;
ret = device_create_file(&pdev->dev, &dev_attr_role);
if (ret < 0)
@@ -2858,6 +2858,9 @@ static int renesas_usb3_probe(struct platform_device *pdev)
err_dev_create:
usb_del_gadget_udc(&usb3->gadget);
+err_pm_disable:
+ pm_runtime_disable(&pdev->dev);
+
err_add_udc:
renesas_usb3_dma_free_prd(usb3, &pdev->dev);
The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced. Fixes: d998844016b24 ("usb: gadget: udc: renesas_usb3: should call pm_runtime_enable() before add udc") Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com> --- drivers/usb/gadget/udc/renesas_usb3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)