diff mbox series

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

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

Commit Message

Krzysztof Kozlowski Aug. 14, 2024, 10:18 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>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/usb/dwc3/dwc3-xilinx.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Radhey Shyam Pandey Aug. 14, 2024, 10:31 a.m. UTC | #1
> -----Original Message-----
> From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Sent: Wednesday, August 14, 2024 3:49 PM
> To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>; Greg Kroah-Hartman
> <gregkh@linuxfoundation.org>; Simek, Michal <michal.simek@amd.com>;
> Grygorii Strashko <grygorii.strashko@ti.com>; Vignesh R <vigneshr@ti.com>;
> Felipe Balbi <felipe.balbi@linux.intel.com>; Pandey, Radhey Shyam
> <radhey.shyam.pandey@amd.com>; Piyush Mehta
> <piyush.mehta@amd.com>; linux-usb@vger.kernel.org; linux-
> omap@vger.kernel.org; linux-kernel@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>;
> stable@vger.kernel.org
> Subject: [PATCH 2/2] usb: dwc3: xilinx: add missing depopulate in probe
> error path
> 
> 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>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Thanks!
> ---
>  drivers/usb/dwc3/dwc3-xilinx.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
> index bb4d894c16e9..b7613a106da6 100644
> --- a/drivers/usb/dwc3/dwc3-xilinx.c
> +++ b/drivers/usb/dwc3/dwc3-xilinx.c
> @@ -330,6 +330,7 @@ static int dwc3_xlnx_probe(struct platform_device
> *pdev)
>  	return pm_runtime_resume_and_get(dev);
> 
>  err_pm_set_suspended:
> +	of_platform_depopulate(dev);
>  	pm_runtime_set_suspended(dev);
> 
>  err_clk_put:
> --
> 2.43.0
Thinh Nguyen Aug. 14, 2024, 11:31 p.m. UTC | #2
On Wed, Aug 14, 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>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  drivers/usb/dwc3/dwc3-xilinx.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
> index bb4d894c16e9..b7613a106da6 100644
> --- a/drivers/usb/dwc3/dwc3-xilinx.c
> +++ b/drivers/usb/dwc3/dwc3-xilinx.c
> @@ -330,6 +330,7 @@ static int dwc3_xlnx_probe(struct platform_device *pdev)
>  	return pm_runtime_resume_and_get(dev);

If pm_runtime_resume_and_get() fails, then probe will fail. We should
probably cleanup in that case too.

BR,
Thinh

>  
>  err_pm_set_suspended:
> +	of_platform_depopulate(dev);
>  	pm_runtime_set_suspended(dev);
>  
>  err_clk_put:
> -- 
> 2.43.0
>
Krzysztof Kozlowski Aug. 16, 2024, 5:30 a.m. UTC | #3
On 15/08/2024 01:31, Thinh Nguyen wrote:
> On Wed, Aug 14, 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>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> ---
>>  drivers/usb/dwc3/dwc3-xilinx.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
>> index bb4d894c16e9..b7613a106da6 100644
>> --- a/drivers/usb/dwc3/dwc3-xilinx.c
>> +++ b/drivers/usb/dwc3/dwc3-xilinx.c
>> @@ -330,6 +330,7 @@ static int dwc3_xlnx_probe(struct platform_device *pdev)
>>  	return pm_runtime_resume_and_get(dev);
> 
> If pm_runtime_resume_and_get() fails, then probe will fail. We should
> probably cleanup in that case too.

I will take a look.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
index bb4d894c16e9..b7613a106da6 100644
--- a/drivers/usb/dwc3/dwc3-xilinx.c
+++ b/drivers/usb/dwc3/dwc3-xilinx.c
@@ -330,6 +330,7 @@  static int dwc3_xlnx_probe(struct platform_device *pdev)
 	return pm_runtime_resume_and_get(dev);
 
 err_pm_set_suspended:
+	of_platform_depopulate(dev);
 	pm_runtime_set_suspended(dev);
 
 err_clk_put: