From: sashiko-bot@kernel.org
To: "Rajan Yadav" <rajanyadav0307@gmail.com>
Cc: linux-usb@vger.kernel.org, linux-sunxi@lists.linux.dev
Subject: Re: [PATCH 2/2] usb: musb: sunxi: Unregister the extcon notifier in sunxi_musb_exit()
Date: Tue, 10 Nov 2026 07:26:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-206485@kernel.org> (raw)
In-Reply-To: <20261110-musb-sunxi-unbind-v1-2-d821584fc4a4@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] usb: musb: sunxi: missing cancel_work_sync() in
sunxi_musb_init()
--
commit b343ab879ad454784f848e3901439d97d89167a9
Author: Rajan Yadav <rajanyadav0307@gmail.com>
usb: musb: sunxi: Unregister the extcon notifier in sunxi_musb_exit()
This commit switches sunxi_musb_init() from devm_extcon_register_notifier()
to extcon_register_notifier() and unregisters the notifier in
sunxi_musb_exit() and on the sunxi_musb_init() error path.
> diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c
> index d880c3758c91b..e9107ae9d3417 100644
> --- a/drivers/usb/musb/sunxi.c
> +++ b/drivers/usb/musb/sunxi.c
> @@ -246,15 +246,19 @@ static int sunxi_musb_init(struct musb *musb)
>
> writeb(SUNXI_MUSB_VEND0_PIO_MODE, musb->mregs + SUNXI_MUSB_VEND0);
>
> - /* Register notifier before calling phy_init() */
> - ret = devm_extcon_register_notifier(glue->dev, glue->extcon,
> - EXTCON_USB_HOST, &glue->host_nb);
> + /*
> + * Register notifier before calling phy_init(). It is unregistered in
> + * sunxi_musb_exit(), as this runs again each time the musb-hdrc child
> + * is bound.
> + */
> + ret = extcon_register_notifier(glue->extcon, EXTCON_USB_HOST,
> + &glue->host_nb);
> if (ret)
> goto error_reset_assert;
>
> ret = phy_init(glue->phy);
> if (ret)
> - goto error_reset_assert;
> + goto error_unregister_notifier;
>
> musb->isr = sunxi_musb_interrupt;
>
> @@ -263,6 +267,9 @@ static int sunxi_musb_init(struct musb *musb)
>
> return 0;
>
> +error_unregister_notifier:
> + extcon_unregister_notifier(glue->extcon, EXTCON_USB_HOST,
> + &glue->host_nb);
> error_reset_assert:
> if (test_bit(SUNXI_MUSB_FL_HAS_RESET, &glue->flags))
> reset_control_assert(glue->rst);
[Severity: Medium]
Should the error_unregister_notifier path also call
cancel_work_sync(&glue->work) after extcon_unregister_notifier(), just like
sunxi_musb_exit() does?
An EXTCON_USB_HOST event arriving between extcon_register_notifier() and a
failing phy_init() schedules glue->work via sunxi_musb_host_notifier().
Because musb-hdrc fails to bind, unbinding the glue device in
sunxi_musb_remove() will not run sunxi_musb_exit() and devres can free
glue while glue->work is still queued or running.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110-musb-sunxi-unbind-v1-0-d821584fc4a4@gmail.com?part=2
prev parent reply other threads:[~2026-11-10 7:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 7:08 [PATCH 0/2] usb: musb: sunxi: Fix unbinding and rebinding Rajan Yadav
2026-11-10 7:08 ` Rajan Yadav via B4 Relay
2026-11-10 7:08 ` [PATCH 1/2] usb: musb: sunxi: Unregister the generic PHY after dropping its reference Rajan Yadav
2026-11-10 7:08 ` Rajan Yadav via B4 Relay
2026-11-10 7:13 ` sashiko-bot
2026-11-10 7:08 ` [PATCH 2/2] usb: musb: sunxi: Unregister the extcon notifier in sunxi_musb_exit() Rajan Yadav
2026-11-10 7:08 ` Rajan Yadav via B4 Relay
2026-11-10 7:26 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-206485@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=linux-usb@vger.kernel.org \
--cc=rajanyadav0307@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.