From: sashiko-bot@kernel.org
To: "Cong Nguyen" <congnt264@gmail.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: typec: tipd: cancel the poll work on probe error
Date: Mon, 30 Nov 2026 13:08:17 +0000 [thread overview]
Message-ID: <sashiko-outbox-241156@kernel.org> (raw)
In-Reply-To: <20261130125448.2300198-1-congnt264@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] usb: typec: tipd: tps6598x_probe() queues wq_poll after
connect() error
--
commit d10e175d4dc048ad0066d5eb5967c060b86270e0
Author: Cong Nguyen <congnt264@gmail.com>
usb: typec: tipd: cancel the poll work on probe error
This commit cancels tps->wq_poll on the err_disconnect error path in
tps6598x_probe() when running in polling mode.
> diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
> index 02539378ffeda..991d42e35777a 100644
> --- a/drivers/usb/typec/tipd/core.c
> +++ b/drivers/usb/typec/tipd/core.c
> @@ -1928,6 +1928,8 @@ static int tps6598x_probe(struct i2c_client *client)
> return 0;
>
> err_disconnect:
> + if (!client->irq)
> + cancel_delayed_work_sync(&tps->wq_poll);
> tps6598x_disconnect(tps, 0);
> err_unregister_port:
> tps->data->unregister_port(tps);
[Severity: Medium]
Why queue tps->wq_poll when ret is already non-zero, only to immediately
jump to err_disconnect and cancel it?
drivers/usb/typec/tipd/core.c:tps6598x_probe() {
...
ret = tps->data->connect(tps, status);
if (ret)
dev_err(&client->dev, "failed to register partner\n");
}
if (client->irq) {
ret = devm_request_threaded_irq(&client->dev, client->irq, NULL,
tps->data->irq_handler,
IRQF_SHARED | IRQF_ONESHOT,
dev_name(&client->dev), tps);
} else {
dev_dbg(tps->dev, "no IRQ specified, using polling mode\n");
INIT_DELAYED_WORK(&tps->wq_poll, tps6598x_poll_work);
queue_delayed_work(system_power_efficient_wq, &tps->wq_poll,
msecs_to_jiffies(POLL_INTERVAL));
}
if (ret)
goto err_disconnect;
...
}
In IRQ mode, devm_request_threaded_irq() overwrites ret from
tps->data->connect(), so an initial partner registration error is logged
and probe succeeds. In polling mode, nothing after queue_delayed_work()
sets ret or jumps to err_disconnect, so a connect() failure queues
tps->wq_poll, immediately cancels it, and fails the controller probe.
Checking ret inside the if (client->irq) block (or before it if connect()
failures are meant to be fatal in both modes) would avoid queuing and
immediately canceling tps->wq_poll.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130125448.2300198-1-congnt264@gmail.com?part=1
prev parent reply other threads:[~2026-11-30 13:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 12:54 [PATCH] usb: typec: tipd: cancel the poll work on probe error Cong Nguyen
2026-11-30 13:08 ` 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-241156@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=congnt264@gmail.com \
--cc=linux-usb@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox