Skip to contentSkip to conversation

usb: musb: mpfs: fix phy unregister in remove()

PATCH In review Felix Gu 2 participants 2 messages Sep 14 – Sep 15

Subsystems (4)
lore
Share & tools
lore

Felix Gu

author
#0 lore raw

PATCH 1/1 usb: musb: mpfs: fix phy unregister in remove()

mpfs_remove() passed the glue platform device instead of the registered generic PHY to usb_phy_generic_unregister(). This unregistered the glue device from within its own remove callback and leaked glue->phy.

Pass glue->phy instead.

Fixes 7a96b6ea90a4 ("usb: musb: Add support for PolarFire SoC's musb controller")
---
 drivers/usb/musb/mpfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/musb/mpfs.c +1 -1
index 587127abd30a..6cc2909b8ae3 100644
@@ -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

---
base-commit: 68142f986ff04b2b70b31db00f719bf690f64a9a
change-id: 20260914-mpfs-086b7d22f8e5

Best regards,

Signature · 1 line
Felix Gu <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Felix Gu

mpfs_remove() passed the glue platform device instead of the registered generic PHY to usb_phy_generic_unregister(). This unregistered the glue device from within its own remove callback and leaked glue->phy.

Pass glue->phy instead.

Fixes 7a96b6ea90a4 ("usb: musb: Add support for PolarFire SoC's musb controller")

Thanks,
Conor.

Quoted 26 lines
---
 drivers/usb/musb/mpfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/musb/mpfs.c +1 -2
index 587127abd30a..6cc2909b8ae3 100644
@@ -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
 
---

base-commit: 68142f986ff04b2b70b31db00f719bf690f64a9a
change-id: 20260914-mpfs-086b7d22f8e5

Best regards,

Signature · 1 line
Felix Gu <[email protected]>