[PATCH] usb: musb: tusb6010: retain and unregister the generic PHY
From: Yige Jiang
Date: Wed Nov 04 2026 - 13:49:21 EST
usb_phy_generic_register() returns the newly registered PHY platform
device, but tusb_probe() discards that pointer. The zero-initialized
glue->phy is later passed to usb_phy_generic_unregister(), leaving the
actual registered device behind.
Store the returned device in glue->phy and stop probe if registration
fails. If registering the MUSB child subsequently fails, unregister
the PHY before returning the error. Normal removal already unregisters
the MUSB child first and can now pass the saved PHY to its cleanup.
Fixes: 2f36ff6915c6 ("usb: phy: generic: allow multiples calls to usb_phy_generic_register()")
Assisted-by: LLM
Signed-off-by: Yige Jiang <yigejiang86@xxxxxxxxx>
---
Based on linux-next next-20261102 (2637bdec0535).
Compile-tested: arm64, GCC 14.2.0, W=1, CONFIG_OF_DYNAMIC=y.
COMPILE_TEST=y.
Baseline and patched target objects built from this exact base.
No full kernel/module-link, hardware or runtime test was performed.
AI assistance: Codex (LLM) for ownership analysis, code and changelog.
The N800/N810 registration path remains in this base. The proposed
OMAP24xx removal affects its future use; please advise on the target tree.
https://lore.kernel.org/all/20260914140821.1805449-1-arnd@xxxxxxxxxx/
drivers/usb/musb/tusb6010.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 1d9571f24a56..a7e0c6fabca4 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -1245,7 +1245,9 @@ static int tusb_probe(struct platform_device *pdev)
pdata->platform_ops = &tusb_ops;
- usb_phy_generic_register();
+ glue->phy = usb_phy_generic_register();
+ if (IS_ERR(glue->phy))
+ return PTR_ERR(glue->phy);
platform_set_drvdata(pdev, glue);
memset(musb_resources, 0x00, sizeof(*musb_resources) *
@@ -1274,6 +1276,7 @@ static int tusb_probe(struct platform_device *pdev)
if (IS_ERR(musb)) {
ret = PTR_ERR(musb);
dev_err(&pdev->dev, "failed to register musb device: %d\n", ret);
+ usb_phy_generic_unregister(glue->phy);
return ret;
}
base-commit: 2637bdec0535a2044cd830eba9a79363651d9043