* [PATCH] usb: musb: tusb6010: retain and unregister the generic PHY
@ 2026-11-04 18:28 Yige Jiang
0 siblings, 0 replies; only message in thread
From: Yige Jiang @ 2026-11-04 18:28 UTC (permalink / raw)
To: linux-usb; +Cc: Yige Jiang, Bin Liu, Greg Kroah-Hartman, linux-kernel
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@gmail.com>
---
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@kernel.org/
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-04 18:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 18:28 [PATCH] usb: musb: tusb6010: retain and unregister the generic PHY Yige Jiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®