linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: cdns3: Fix runtime PM imbalance on error
@ 2020-05-21  7:39 Dinghao Liu
  2020-05-21 23:36 ` Peter Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Dinghao Liu @ 2020-05-21  7:39 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Greg Kroah-Hartman, Felipe Balbi, Pawel Laszczak, Colin Ian King,
	Roger Quadros, linux-usb, linux-kernel

pm_runtime_get_sync() increments the runtime PM usage counter even
when it returns an error code. Thus a pairing decrement is needed on
the error handling path to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/usb/cdns3/cdns3-ti.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c
index 5685ba11480b..e701ab56b0a7 100644
--- a/drivers/usb/cdns3/cdns3-ti.c
+++ b/drivers/usb/cdns3/cdns3-ti.c
@@ -138,7 +138,7 @@ static int cdns_ti_probe(struct platform_device *pdev)
 	error = pm_runtime_get_sync(dev);
 	if (error < 0) {
 		dev_err(dev, "pm_runtime_get_sync failed: %d\n", error);
-		goto err_get;
+		goto err;
 	}
 
 	/* assert RESET */
@@ -185,7 +185,6 @@ static int cdns_ti_probe(struct platform_device *pdev)
 
 err:
 	pm_runtime_put_sync(data->dev);
-err_get:
 	pm_runtime_disable(data->dev);
 
 	return error;
-- 
2.17.1


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

* Re: [PATCH] usb: cdns3: Fix runtime PM imbalance on error
  2020-05-21  7:39 [PATCH] usb: cdns3: Fix runtime PM imbalance on error Dinghao Liu
@ 2020-05-21 23:36 ` Peter Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Chen @ 2020-05-21 23:36 UTC (permalink / raw)
  To: Dinghao Liu
  Cc: kjlu, Greg Kroah-Hartman, Felipe Balbi, Pawel Laszczak,
	Colin Ian King, Roger Quadros, USB list, lkml

On Thu, May 21, 2020 at 3:42 PM Dinghao Liu <dinghao.liu@zju.edu.cn> wrote:
>
> pm_runtime_get_sync() increments the runtime PM usage counter even
> when it returns an error code. Thus a pairing decrement is needed on
> the error handling path to keep the counter balanced.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  drivers/usb/cdns3/cdns3-ti.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c
> index 5685ba11480b..e701ab56b0a7 100644
> --- a/drivers/usb/cdns3/cdns3-ti.c
> +++ b/drivers/usb/cdns3/cdns3-ti.c
> @@ -138,7 +138,7 @@ static int cdns_ti_probe(struct platform_device *pdev)
>         error = pm_runtime_get_sync(dev);
>         if (error < 0) {
>                 dev_err(dev, "pm_runtime_get_sync failed: %d\n", error);
> -               goto err_get;
> +               goto err;
>         }
>
>         /* assert RESET */
> @@ -185,7 +185,6 @@ static int cdns_ti_probe(struct platform_device *pdev)
>
>  err:
>         pm_runtime_put_sync(data->dev);
> -err_get:
>         pm_runtime_disable(data->dev);
>
>         return error;
> --

Reviewed-by: Peter Chen <peter.chen@nxp.com>

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

end of thread, other threads:[~2020-05-21 23:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-21  7:39 [PATCH] usb: cdns3: Fix runtime PM imbalance on error Dinghao Liu
2020-05-21 23:36 ` 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).