linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [v2] usb: cdns3: Fix runtime PM imbalance on error
@ 2021-04-12  5:49 Dinghao Liu
  2021-04-19  3:55 ` Peter Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Dinghao Liu @ 2021-04-12  5:49 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>
---

Changelog:

v2: - Use pm_runtime_put_sync() to decrease refcount.
---
 drivers/usb/cdns3/cdns3-gadget.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
index 582bfeceedb4..a49fc68ec2ef 100644
--- a/drivers/usb/cdns3/cdns3-gadget.c
+++ b/drivers/usb/cdns3/cdns3-gadget.c
@@ -3255,8 +3255,10 @@ 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_put_sync(cdns->dev);
 		return ret;
+	}
 
 	/*
 	 * Because interrupt line can be shared with other components in
-- 
2.17.1


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

* Re: [PATCH] [v2] usb: cdns3: Fix runtime PM imbalance on error
  2021-04-12  5:49 [PATCH] [v2] usb: cdns3: Fix runtime PM imbalance on error Dinghao Liu
@ 2021-04-19  3:55 ` Peter Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Chen @ 2021-04-19  3:55 UTC (permalink / raw)
  To: Dinghao Liu
  Cc: kjlu, Pawel Laszczak, Roger Quadros, Aswath Govindraju,
	Greg Kroah-Hartman, linux-usb, linux-kernel

On 21-04-12 13:49:07, Dinghao Liu wrote:
> 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>

Applied, thanks.

Peter
> ---
> 
> Changelog:
> 
> v2: - Use pm_runtime_put_sync() to decrease refcount.
> ---
>  drivers/usb/cdns3/cdns3-gadget.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
> index 582bfeceedb4..a49fc68ec2ef 100644
> --- a/drivers/usb/cdns3/cdns3-gadget.c
> +++ b/drivers/usb/cdns3/cdns3-gadget.c
> @@ -3255,8 +3255,10 @@ 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_put_sync(cdns->dev);
>  		return ret;
> +	}
>  
>  	/*
>  	 * Because interrupt line can be shared with other components in
> -- 
> 2.17.1
> 

-- 

Thanks,
Peter Chen


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

end of thread, other threads:[~2021-04-19  3:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12  5:49 [PATCH] [v2] usb: cdns3: Fix runtime PM imbalance on error Dinghao Liu
2021-04-19  3:55 ` Peter Chen

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