[PATCH] usb: musb: mpfs: unregister the generic PHY device on remove
Wentao Liang
vulab at iscas.ac.cn
Tue Nov 3 18:15:22 PST 2026
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 at vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab at 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
More information about the linux-riscv
mailing list