[PATCH v2 3/5] usb: ohci-nxp: fix device leak on probe failure

Johan Hovold posted 5 patches 1 month, 3 weeks ago
[PATCH v2 3/5] usb: ohci-nxp: fix device leak on probe failure
Posted by Johan Hovold 1 month, 3 weeks ago
Make sure to drop the reference taken when looking up the PHY I2C device
during probe on probe failure (e.g. probe deferral) and on driver
unbind.

Fixes: 73108aa90cbf ("USB: ohci-nxp: Use isp1301 driver")
Cc: stable@vger.kernel.org	# 3.5
Reported-by: Ma Ke <make24@iscas.ac.cn>
Link: https://lore.kernel.org/lkml/20251117013428.21840-1-make24@iscas.ac.cn/
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/host/ohci-nxp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index 24d5a1dc5056..509ca7d8d513 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -223,6 +223,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
 fail_resource:
 	usb_put_hcd(hcd);
 fail_disable:
+	put_device(&isp1301_i2c_client->dev);
 	isp1301_i2c_client = NULL;
 	return ret;
 }
@@ -234,6 +235,7 @@ static void ohci_hcd_nxp_remove(struct platform_device *pdev)
 	usb_remove_hcd(hcd);
 	ohci_nxp_stop_hc();
 	usb_put_hcd(hcd);
+	put_device(&isp1301_i2c_client->dev);
 	isp1301_i2c_client = NULL;
 }
 
-- 
2.51.2
Re: [PATCH v2 3/5] usb: ohci-nxp: fix device leak on probe failure
Posted by Vladimir Zapolskiy 1 month, 2 weeks ago
On 12/18/25 17:35, Johan Hovold wrote:
> Make sure to drop the reference taken when looking up the PHY I2C device
> during probe on probe failure (e.g. probe deferral) and on driver
> unbind.
> 
> Fixes: 73108aa90cbf ("USB: ohci-nxp: Use isp1301 driver")
> Cc: stable@vger.kernel.org	# 3.5
> Reported-by: Ma Ke <make24@iscas.ac.cn>
> Link: https://lore.kernel.org/lkml/20251117013428.21840-1-make24@iscas.ac.cn/
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>   drivers/usb/host/ohci-nxp.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
> index 24d5a1dc5056..509ca7d8d513 100644
> --- a/drivers/usb/host/ohci-nxp.c
> +++ b/drivers/usb/host/ohci-nxp.c
> @@ -223,6 +223,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
>   fail_resource:
>   	usb_put_hcd(hcd);
>   fail_disable:
> +	put_device(&isp1301_i2c_client->dev);
>   	isp1301_i2c_client = NULL;
>   	return ret;
>   }
> @@ -234,6 +235,7 @@ static void ohci_hcd_nxp_remove(struct platform_device *pdev)
>   	usb_remove_hcd(hcd);
>   	ohci_nxp_stop_hc();
>   	usb_put_hcd(hcd);
> +	put_device(&isp1301_i2c_client->dev);
>   	isp1301_i2c_client = NULL;
>   }
>   

Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>

-- 
Best wishes,
Vladimir
Re: [PATCH v2 3/5] usb: ohci-nxp: fix device leak on probe failure
Posted by Alan Stern 1 month, 3 weeks ago
On Thu, Dec 18, 2025 at 04:35:17PM +0100, Johan Hovold wrote:
> Make sure to drop the reference taken when looking up the PHY I2C device
> during probe on probe failure (e.g. probe deferral) and on driver
> unbind.
> 
> Fixes: 73108aa90cbf ("USB: ohci-nxp: Use isp1301 driver")
> Cc: stable@vger.kernel.org	# 3.5
> Reported-by: Ma Ke <make24@iscas.ac.cn>
> Link: https://lore.kernel.org/lkml/20251117013428.21840-1-make24@iscas.ac.cn/
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---

For this patch and the 5/5 patch:

Acked-by: Alan Stern <stern@rowland.harvard.edu>

Alan Stern

>  drivers/usb/host/ohci-nxp.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
> index 24d5a1dc5056..509ca7d8d513 100644
> --- a/drivers/usb/host/ohci-nxp.c
> +++ b/drivers/usb/host/ohci-nxp.c
> @@ -223,6 +223,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
>  fail_resource:
>  	usb_put_hcd(hcd);
>  fail_disable:
> +	put_device(&isp1301_i2c_client->dev);
>  	isp1301_i2c_client = NULL;
>  	return ret;
>  }
> @@ -234,6 +235,7 @@ static void ohci_hcd_nxp_remove(struct platform_device *pdev)
>  	usb_remove_hcd(hcd);
>  	ohci_nxp_stop_hc();
>  	usb_put_hcd(hcd);
> +	put_device(&isp1301_i2c_client->dev);
>  	isp1301_i2c_client = NULL;
>  }
>  
> -- 
> 2.51.2
>