mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: dwc3: omap: add missing depopulate in probe error path
@ 2024-08-14 10:18 Krzysztof Kozlowski
  2024-08-14 10:18 ` [PATCH 2/2] usb: dwc3: xilinx: " Krzysztof Kozlowski
  2024-08-14 23:22 ` [PATCH 1/2] usb: dwc3: omap: " Thinh Nguyen
  0 siblings, 2 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-14 10:18 UTC (permalink / raw)
  To: Thinh Nguyen, Greg Kroah-Hartman, Michal Simek,
	Grygorii Strashko, Vignesh R, Felipe Balbi, Radhey Shyam Pandey,
	Piyush Mehta, linux-usb, linux-omap, linux-kernel,
	linux-arm-kernel
  Cc: Krzysztof Kozlowski, stable

Depopulate device in probe error paths to fix leak of children
resources.

Fixes: ee249b455494 ("usb: dwc3: omap: remove IRQ_NOAUTOEN used with shared irq")
Cc: <stable@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/usb/dwc3/dwc3-omap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index d5c77db4daa9..2a11fc0ee84f 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -522,11 +522,13 @@ static int dwc3_omap_probe(struct platform_device *pdev)
 	if (ret) {
 		dev_err(dev, "failed to request IRQ #%d --> %d\n",
 			omap->irq, ret);
-		goto err1;
+		goto err2;
 	}
 	dwc3_omap_enable_irqs(omap);
 	return 0;
 
+err2:
+	of_platform_depopulate(dev);
 err1:
 	pm_runtime_put_sync(dev);
 	pm_runtime_disable(dev);
-- 
2.43.0


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

* [PATCH 2/2] usb: dwc3: xilinx: add missing depopulate in probe error path
  2024-08-14 10:18 [PATCH 1/2] usb: dwc3: omap: add missing depopulate in probe error path Krzysztof Kozlowski
@ 2024-08-14 10:18 ` Krzysztof Kozlowski
  2024-08-14 10:31   ` Pandey, Radhey Shyam
  2024-08-14 23:31   ` Thinh Nguyen
  2024-08-14 23:22 ` [PATCH 1/2] usb: dwc3: omap: " Thinh Nguyen
  1 sibling, 2 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-14 10:18 UTC (permalink / raw)
  To: Thinh Nguyen, Greg Kroah-Hartman, Michal Simek,
	Grygorii Strashko, Vignesh R, Felipe Balbi, Radhey Shyam Pandey,
	Piyush Mehta, linux-usb, linux-omap, linux-kernel,
	linux-arm-kernel
  Cc: Krzysztof Kozlowski, stable

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);
 
 err_pm_set_suspended:
+	of_platform_depopulate(dev);
 	pm_runtime_set_suspended(dev);
 
 err_clk_put:
-- 
2.43.0


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

* RE: [PATCH 2/2] usb: dwc3: xilinx: add missing depopulate in probe error path
  2024-08-14 10:18 ` [PATCH 2/2] usb: dwc3: xilinx: " Krzysztof Kozlowski
@ 2024-08-14 10:31   ` Pandey, Radhey Shyam
  2024-08-14 23:31   ` Thinh Nguyen
  1 sibling, 0 replies; 6+ messages in thread
From: Pandey, Radhey Shyam @ 2024-08-14 10:31 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Thinh Nguyen, Greg Kroah-Hartman, Simek,
	Michal, Grygorii Strashko, Vignesh R, Felipe Balbi, Piyush Mehta,
	linux-usb, linux-omap, linux-kernel, linux-arm-kernel
  Cc: stable

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


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

* Re: [PATCH 1/2] usb: dwc3: omap: add missing depopulate in probe error path
  2024-08-14 10:18 [PATCH 1/2] usb: dwc3: omap: add missing depopulate in probe error path Krzysztof Kozlowski
  2024-08-14 10:18 ` [PATCH 2/2] usb: dwc3: xilinx: " Krzysztof Kozlowski
@ 2024-08-14 23:22 ` Thinh Nguyen
  1 sibling, 0 replies; 6+ messages in thread
From: Thinh Nguyen @ 2024-08-14 23:22 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Thinh Nguyen, Greg Kroah-Hartman, Michal Simek,
	Grygorii Strashko, Vignesh R, Felipe Balbi, Radhey Shyam Pandey,
	Piyush Mehta, linux-usb, linux-omap, linux-kernel,
	linux-arm-kernel, stable

On Wed, Aug 14, 2024, Krzysztof Kozlowski wrote:
> Depopulate device in probe error paths to fix leak of children
> resources.
> 
> Fixes: ee249b455494 ("usb: dwc3: omap: remove IRQ_NOAUTOEN used with shared irq")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  drivers/usb/dwc3/dwc3-omap.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
> index d5c77db4daa9..2a11fc0ee84f 100644
> --- a/drivers/usb/dwc3/dwc3-omap.c
> +++ b/drivers/usb/dwc3/dwc3-omap.c
> @@ -522,11 +522,13 @@ static int dwc3_omap_probe(struct platform_device *pdev)
>  	if (ret) {
>  		dev_err(dev, "failed to request IRQ #%d --> %d\n",
>  			omap->irq, ret);
> -		goto err1;
> +		goto err2;
>  	}
>  	dwc3_omap_enable_irqs(omap);
>  	return 0;
>  
> +err2:
> +	of_platform_depopulate(dev);
>  err1:
>  	pm_runtime_put_sync(dev);
>  	pm_runtime_disable(dev);
> -- 
> 2.43.0
> 

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

Thanks,
Thinh

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

* Re: [PATCH 2/2] usb: dwc3: xilinx: add missing depopulate in probe error path
  2024-08-14 10:18 ` [PATCH 2/2] usb: dwc3: xilinx: " Krzysztof Kozlowski
  2024-08-14 10:31   ` Pandey, Radhey Shyam
@ 2024-08-14 23:31   ` Thinh Nguyen
  2024-08-16  5:30     ` Krzysztof Kozlowski
  1 sibling, 1 reply; 6+ messages in thread
From: Thinh Nguyen @ 2024-08-14 23:31 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Thinh Nguyen, Greg Kroah-Hartman, Michal Simek,
	Grygorii Strashko, Vignesh R, Felipe Balbi, Radhey Shyam Pandey,
	Piyush Mehta, linux-usb, linux-omap, linux-kernel,
	linux-arm-kernel, stable

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
> 

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

* Re: [PATCH 2/2] usb: dwc3: xilinx: add missing depopulate in probe error path
  2024-08-14 23:31   ` Thinh Nguyen
@ 2024-08-16  5:30     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-16  5:30 UTC (permalink / raw)
  To: Thinh Nguyen
  Cc: Greg Kroah-Hartman, Michal Simek, Grygorii Strashko, Vignesh R,
	Felipe Balbi, Radhey Shyam Pandey, Piyush Mehta, linux-usb,
	linux-omap, linux-kernel, linux-arm-kernel, stable

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


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

end of thread, other threads:[~2024-08-16  5:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-14 10:18 [PATCH 1/2] usb: dwc3: omap: add missing depopulate in probe error path Krzysztof Kozlowski
2024-08-14 10:18 ` [PATCH 2/2] usb: dwc3: xilinx: " Krzysztof Kozlowski
2024-08-14 10:31   ` Pandey, Radhey Shyam
2024-08-14 23:31   ` Thinh Nguyen
2024-08-16  5:30     ` Krzysztof Kozlowski
2024-08-14 23:22 ` [PATCH 1/2] usb: dwc3: omap: " Thinh Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®