linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: udc: renesas_usb3: Fix PM disable depth imbalance on error handling
@ 2020-11-11 14:24 Zhang Qilong
  0 siblings, 0 replies; only message in thread
From: Zhang Qilong @ 2020-11-11 14:24 UTC (permalink / raw)
  To: balbi, gregkh; +Cc: linux-usb

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 --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);
 
-- 
2.25.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-11 14:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11 14:24 [PATCH] usb: gadget: udc: renesas_usb3: Fix PM disable depth imbalance on error handling Zhang Qilong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).