Linux-USB Archive on lore.kernel.org
 help / color / 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	[flat|nested] 3+ messages in thread

end of thread, back to index

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

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git