diff mbox series

[v2,2/2] usb: dwc3: xilinx: add missing depopulate in probe error path

Message ID 20240816075409.23080-2-krzysztof.kozlowski@linaro.org
State New
Headers show
Series [v2,1/2] usb: dwc3: omap: add missing depopulate in probe error path | expand

Commit Message

Krzysztof Kozlowski Aug. 16, 2024, 7:54 a.m. UTC
Depopulate device in probe error paths to fix leak of children
resources.

Fixes: 53b5ff83d893 ("usb: dwc3: xilinx: improve error handling for PM APIs")
Cc: stable@vger.kernel.org
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Changes in v2:
1. Add goto also on pm_runtime_resume_and_get() failure (Thinh)
2. Add Rb tag.
---
 drivers/usb/dwc3/dwc3-xilinx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Thinh Nguyen Aug. 16, 2024, 10:32 p.m. UTC | #1
On Fri, Aug 16, 2024, Krzysztof Kozlowski wrote:
> Depopulate device in probe error paths to fix leak of children
> resources.
> 
> Fixes: 53b5ff83d893 ("usb: dwc3: xilinx: improve error handling for PM APIs")
> Cc: stable@vger.kernel.org
> Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> ---
> 
> Changes in v2:
> 1. Add goto also on pm_runtime_resume_and_get() failure (Thinh)
> 2. Add Rb tag.
> ---
>  drivers/usb/dwc3/dwc3-xilinx.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
> index bb4d894c16e9..f1298b1b4f84 100644
> --- a/drivers/usb/dwc3/dwc3-xilinx.c
> +++ b/drivers/usb/dwc3/dwc3-xilinx.c
> @@ -327,9 +327,14 @@ static int dwc3_xlnx_probe(struct platform_device *pdev)
>  		goto err_pm_set_suspended;
>  
>  	pm_suspend_ignore_children(dev, false);
> -	return pm_runtime_resume_and_get(dev);
> +	ret = pm_runtime_resume_and_get(dev);
> +	if (ret < 0)
> +		goto err_pm_set_suspended;
> +
> +	return 0;
>  
>  err_pm_set_suspended:
> +	of_platform_depopulate(dev);
>  	pm_runtime_set_suspended(dev);
>  
>  err_clk_put:
> -- 
> 2.43.0
> 

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

Thanks,
Thinh
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
index bb4d894c16e9..f1298b1b4f84 100644
--- a/drivers/usb/dwc3/dwc3-xilinx.c
+++ b/drivers/usb/dwc3/dwc3-xilinx.c
@@ -327,9 +327,14 @@  static int dwc3_xlnx_probe(struct platform_device *pdev)
 		goto err_pm_set_suspended;
 
 	pm_suspend_ignore_children(dev, false);
-	return pm_runtime_resume_and_get(dev);
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret < 0)
+		goto err_pm_set_suspended;
+
+	return 0;
 
 err_pm_set_suspended:
+	of_platform_depopulate(dev);
 	pm_runtime_set_suspended(dev);
 
 err_clk_put: