All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: musb: mpfs: unregister the generic PHY device on remove
@ 2026-11-04  2:15 ` Wentao Liang
  0 siblings, 0 replies; 5+ messages in thread
From: Wentao Liang @ 2026-11-04  2:15 UTC (permalink / raw)
  To: Conor Dooley, Valentina Fernandez, Daire McNamara, Bin Liu,
	Greg Kroah-Hartman
  Cc: linux-riscv, linux-usb

mpfs_probe() creates the "usb_phy_generic" platform device with
usb_phy_generic_register() and keeps it in glue->phy, but mpfs_remove()
hands the controller's own platform device to
usb_phy_generic_unregister().  The generic PHY device is therefore never
unregistered and its reference is leaked, while the controller device,
which the driver core is in the middle of removing, is torn down a
second time.

Pass glue->phy, as the probe error path already does.

Fixes: 7a96b6ea90a4 ("usb: musb: Add support for PolarFire SoC's musb controller")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/usb/musb/mpfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/mpfs.c b/drivers/usb/musb/mpfs.c
index 587127abd30a..6cc2909b8ae3 100644
--- a/drivers/usb/musb/mpfs.c
+++ b/drivers/usb/musb/mpfs.c
@@ -357,7 +357,7 @@ static void mpfs_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(glue->clk);
 	platform_device_unregister(glue->musb);
-	usb_phy_generic_unregister(pdev);
+	usb_phy_generic_unregister(glue->phy);
 }
 
 #ifdef CONFIG_OF
-- 
2.34.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH] usb: musb: mpfs: unregister the generic PHY device on remove
@ 2026-11-04  2:15 ` Wentao Liang
  0 siblings, 0 replies; 5+ messages in thread
From: Wentao Liang @ 2026-11-04  2:15 UTC (permalink / raw)
  To: Conor Dooley, Valentina Fernandez, Daire McNamara, Bin Liu,
	Greg Kroah-Hartman
  Cc: linux-riscv, linux-usb

mpfs_probe() creates the "usb_phy_generic" platform device with
usb_phy_generic_register() and keeps it in glue->phy, but mpfs_remove()
hands the controller's own platform device to
usb_phy_generic_unregister().  The generic PHY device is therefore never
unregistered and its reference is leaked, while the controller device,
which the driver core is in the middle of removing, is torn down a
second time.

Pass glue->phy, as the probe error path already does.

Fixes: 7a96b6ea90a4 ("usb: musb: Add support for PolarFire SoC's musb controller")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/usb/musb/mpfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/mpfs.c b/drivers/usb/musb/mpfs.c
index 587127abd30a..6cc2909b8ae3 100644
--- a/drivers/usb/musb/mpfs.c
+++ b/drivers/usb/musb/mpfs.c
@@ -357,7 +357,7 @@ static void mpfs_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(glue->clk);
 	platform_device_unregister(glue->musb);
-	usb_phy_generic_unregister(pdev);
+	usb_phy_generic_unregister(glue->phy);
 }
 
 #ifdef CONFIG_OF
-- 
2.34.1


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

* Re: [PATCH] usb: musb: mpfs: unregister the generic PHY device on remove
  2026-11-04  2:15 ` Wentao Liang
  (?)
@ 2026-11-04  2:31 ` sashiko-bot
  -1 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-11-04  2:31 UTC (permalink / raw)
  To: Wentao Liang; +Cc: linux-usb

> mpfs_probe() creates the "usb_phy_generic" platform device with
> usb_phy_generic_register() and keeps it in glue->phy, but mpfs_remove()
> hands the controller's own platform device to
> usb_phy_generic_unregister().  The generic PHY device is therefore never
> unregistered and its reference is leaked, while the controller device,
> which the driver core is in the middle of removing, is torn down a
> second time.
> 
> Pass glue->phy, as the probe error path already does.
> 
> Fixes: 7a96b6ea90a4 ("usb: musb: Add support for PolarFire SoC's musb controller")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261104021522.1468663-1-vulab@iscas.ac.cn?part=1


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

* Re: [PATCH] usb: musb: mpfs: unregister the generic PHY device on remove
  2026-11-04  2:15 ` Wentao Liang
@ 2026-11-06 19:07   ` Conor Dooley
  -1 siblings, 0 replies; 5+ messages in thread
From: Conor Dooley @ 2026-11-06 19:07 UTC (permalink / raw)
  To: Wentao Liang
  Cc: Conor Dooley, Valentina Fernandez, Daire McNamara, Bin Liu,
	Greg Kroah-Hartman, linux-riscv, linux-usb

[-- Attachment #1: Type: text/plain, Size: 1443 bytes --]

On Wed, Nov 04, 2026 at 02:15:22AM +0000, Wentao Liang wrote:
> mpfs_probe() creates the "usb_phy_generic" platform device with
> usb_phy_generic_register() and keeps it in glue->phy, but mpfs_remove()
> hands the controller's own platform device to
> usb_phy_generic_unregister().  The generic PHY device is therefore never
> unregistered and its reference is leaked, while the controller device,
> which the driver core is in the middle of removing, is torn down a
> second time.
> 
> Pass glue->phy, as the probe error path already does.
> 
> Fixes: 7a96b6ea90a4 ("usb: musb: Add support for PolarFire SoC's musb controller")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>

Isn't this a duplicate? I'd swear I acked a patch like this from a Felix
Guo months ago.

> ---
>  drivers/usb/musb/mpfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/musb/mpfs.c b/drivers/usb/musb/mpfs.c
> index 587127abd30a..6cc2909b8ae3 100644
> --- a/drivers/usb/musb/mpfs.c
> +++ b/drivers/usb/musb/mpfs.c
> @@ -357,7 +357,7 @@ static void mpfs_remove(struct platform_device *pdev)
>  
>  	clk_disable_unprepare(glue->clk);
>  	platform_device_unregister(glue->musb);
> -	usb_phy_generic_unregister(pdev);
> +	usb_phy_generic_unregister(glue->phy);
>  }
>  
>  #ifdef CONFIG_OF
> -- 
> 2.34.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH] usb: musb: mpfs: unregister the generic PHY device on remove
@ 2026-11-06 19:07   ` Conor Dooley
  0 siblings, 0 replies; 5+ messages in thread
From: Conor Dooley @ 2026-11-06 19:07 UTC (permalink / raw)
  To: Wentao Liang
  Cc: Conor Dooley, Valentina Fernandez, Daire McNamara, Bin Liu,
	Greg Kroah-Hartman, linux-riscv, linux-usb


[-- Attachment #1.1: Type: text/plain, Size: 1443 bytes --]

On Wed, Nov 04, 2026 at 02:15:22AM +0000, Wentao Liang wrote:
> mpfs_probe() creates the "usb_phy_generic" platform device with
> usb_phy_generic_register() and keeps it in glue->phy, but mpfs_remove()
> hands the controller's own platform device to
> usb_phy_generic_unregister().  The generic PHY device is therefore never
> unregistered and its reference is leaked, while the controller device,
> which the driver core is in the middle of removing, is torn down a
> second time.
> 
> Pass glue->phy, as the probe error path already does.
> 
> Fixes: 7a96b6ea90a4 ("usb: musb: Add support for PolarFire SoC's musb controller")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>

Isn't this a duplicate? I'd swear I acked a patch like this from a Felix
Guo months ago.

> ---
>  drivers/usb/musb/mpfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/musb/mpfs.c b/drivers/usb/musb/mpfs.c
> index 587127abd30a..6cc2909b8ae3 100644
> --- a/drivers/usb/musb/mpfs.c
> +++ b/drivers/usb/musb/mpfs.c
> @@ -357,7 +357,7 @@ static void mpfs_remove(struct platform_device *pdev)
>  
>  	clk_disable_unprepare(glue->clk);
>  	platform_device_unregister(glue->musb);
> -	usb_phy_generic_unregister(pdev);
> +	usb_phy_generic_unregister(glue->phy);
>  }
>  
>  #ifdef CONFIG_OF
> -- 
> 2.34.1
> 

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2026-11-06 19:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04  2:15 [PATCH] usb: musb: mpfs: unregister the generic PHY device on remove Wentao Liang
2026-11-04  2:15 ` Wentao Liang
2026-11-04  2:31 ` sashiko-bot
2026-11-06 19:07 ` Conor Dooley
2026-11-06 19:07   ` Conor Dooley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.