diff mbox series

usb: gadget: udc: renesas_usb3: Fix PM disable depth imbalance on error handling

Message ID 20201111142446.306109-1-zhangqilong3@huawei.com (mailing list archive)
State New, archived
Headers show
Series usb: gadget: udc: renesas_usb3: Fix PM disable depth imbalance on error handling | expand

Commit Message

Zhang Qilong Nov. 11, 2020, 2:24 p.m. UTC
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(-)
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 0c418ce50ba0..fd3530a7bf98 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -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);