[02/11] USB: dwc3: fix runtime pm imbalance on unbind

Message ID 20230404072524.19014-3-johan+linaro@kernel.org
State New
Headers
Series USB: dwc3: error handling fixes and cleanups |

Commit Message

Johan Hovold April 4, 2023, 7:25 a.m. UTC
  Make sure to balance the runtime PM usage count on driver unbind by
adding back the pm_runtime_allow() call that had been erroneously
removed.

Fixes: 266d0493900a ("usb: dwc3: core: don't trigger runtime pm when remove driver")
Cc: stable@vger.kernel.org	# 5.9
Cc: Li Jun <jun.li@nxp.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/usb/dwc3/core.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Thinh Nguyen April 11, 2023, 1:22 a.m. UTC | #1
On Tue, Apr 04, 2023, Johan Hovold wrote:
> Make sure to balance the runtime PM usage count on driver unbind by
> adding back the pm_runtime_allow() call that had been erroneously
> removed.
> 
> Fixes: 266d0493900a ("usb: dwc3: core: don't trigger runtime pm when remove driver")
> Cc: stable@vger.kernel.org	# 5.9
> Cc: Li Jun <jun.li@nxp.com>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
>  drivers/usb/dwc3/core.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 5058bd8d56ca..9f8c988c25cb 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1979,6 +1979,7 @@ static int dwc3_remove(struct platform_device *pdev)
>  	dwc3_core_exit(dwc);
>  	dwc3_ulpi_exit(dwc);
>  
> +	pm_runtime_allow(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
>  	pm_runtime_put_noidle(&pdev->dev);
>  	pm_runtime_set_suspended(&pdev->dev);
> -- 
> 2.39.2
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh
  

Patch

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 5058bd8d56ca..9f8c988c25cb 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1979,6 +1979,7 @@  static int dwc3_remove(struct platform_device *pdev)
 	dwc3_core_exit(dwc);
 	dwc3_ulpi_exit(dwc);
 
+	pm_runtime_allow(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);