[PATCH] usb: musb: mpfs: unregister the generic PHY device on remove
Conor Dooley
conor at kernel.org
Fri Nov 6 11:07:49 PST 2026
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 at vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab at 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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20261106/df311ea6/attachment.sig>
More information about the linux-riscv
mailing list