linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: cdns3: Fix rumtime PM imbalance on error
@ 2021-04-07  5:22 Dinghao Liu
  2021-04-10  1:06 ` Peter Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Dinghao Liu @ 2021-04-07  5:22 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Peter Chen, Pawel Laszczak, Roger Quadros, Aswath Govindraju,
	Greg Kroah-Hartman, linux-usb, linux-kernel

When cdns3_gadget_start() fails, a pairing PM usage counter
decrement is needed to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/usb/cdns3/cdns3-gadget.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
index 582bfeceedb4..ad891a108aed 100644
--- a/drivers/usb/cdns3/cdns3-gadget.c
+++ b/drivers/usb/cdns3/cdns3-gadget.c
@@ -3255,8 +3255,11 @@ static int __cdns3_gadget_init(struct cdns *cdns)
 	pm_runtime_get_sync(cdns->dev);
 
 	ret = cdns3_gadget_start(cdns);
-	if (ret)
+	if (ret) {
+		pm_runtime_mark_last_busy(cdns->dev);
+		pm_runtime_put_autosuspend(cdns->dev);
 		return ret;
+	}
 
 	/*
 	 * Because interrupt line can be shared with other components in
-- 
2.17.1


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

end of thread, other threads:[~2021-04-12  5:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07  5:22 [PATCH] usb: cdns3: Fix rumtime PM imbalance on error Dinghao Liu
2021-04-10  1:06 ` Peter Chen
2021-04-12  5:35   ` dinghao.liu

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).