Re: [PATCH] usb: typec: hd3ss3220: disable the interrupt before unregistering the port
From: Heikki Krogerus
Date: Tue Nov 17 2026 - 05:18:54 EST
On Thu, Nov 12, 2026 at 01:56:13AM -0500, Myeonghun Pak wrote:
> The devm-managed IRQ remains active while hd3ss3220_remove() unregisters
> the Type-C port and releases the role switch. A cable event during unbind
> can make hd3ss3220_set_role() access either resource after release.
>
> Disable and synchronize the IRQ before teardown, matching the existing
> polling-work cancellation. The ID pin IRQ needs no change: its GPIO and
> regulator are acquired before it, so devres releases that IRQ first.
>
> Found by a static analysis tool under development.
> Not tested on hardware.
So why still use the managed version of the function to request the
irq? Why not just concert the driver to "normal" request_irq and
free_irq?
Thanks,
> Fixes: 1c48c759ef4b ("usb: typec: driver for TI HD3SS3220 USB Type-C DRP port controller")
> Cc: stable@xxxxxxxxxxxxxxx
> Co-developed-by: Ijae Kim <ae878000@xxxxxxxxx>
> Signed-off-by: Ijae Kim <ae878000@xxxxxxxxx>
> Signed-off-by: Myeonghun Pak <mhun512@xxxxxxxxx>
> ---
>
> drivers/usb/typec/hd3ss3220.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c
> index 60d6de9ba339..19c5dbdc97a1 100644
> --- a/drivers/usb/typec/hd3ss3220.c
> +++ b/drivers/usb/typec/hd3ss3220.c
> @@ -554,6 +554,8 @@ static void hd3ss3220_remove(struct i2c_client *client)
>
> if (hd3ss3220->poll)
> cancel_delayed_work_sync(&hd3ss3220->output_poll_work);
> + else
> + disable_irq(client->irq);
>
> typec_unregister_port(hd3ss3220->port);
> usb_role_switch_put(hd3ss3220->role_sw);
>
> base-commit: 630059a5a632377b9b7b487baccde92b7ae1dd47
> --
> 2.43.0
--
heikki