From: sashiko-bot@kernel.org
To: "Emfox Zhou" <emfox@debian.org>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v11 2/6] HID: intel-thc-hid: intel-ipts: bring up the port
Date: Thu, 03 Dec 2026 02:15:01 +0000 [thread overview]
Message-ID: <sashiko-outbox-246979@kernel.org> (raw)
In-Reply-To: <20261203020433.2631656-2-emfox@debian.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] HID: intel-thc-hid: unchecked state in thc_ipts_port_stop()
on unwind
--
commit 663780af800a067405da9392130d2229f813c4d6
Author: Emfox Zhou <emfox@debian.org>
HID: intel-thc-hid: intel-ipts: bring up the port
This commit adds the Intel Touch Host Controller IPTS mode PCI driver and
protocol support to select the SPI port, reset the controller, read its
configuration block over PIO, apply SPI timing, and enable the touch engine.
> diff --git a/drivers/hid/intel-thc-hid/intel-ipts/ipts-protocol.c b/drivers/hid/intel-thc-hid/intel-ipts/ipts-protocol.c
> new file mode 100644
> index 0000000000000..5d3d8d4005b8f
> --- /dev/null
> +++ b/drivers/hid/intel-thc-hid/intel-ipts/ipts-protocol.c
[ ... ]
> +int thc_ipts_port_start(struct thc_ipts *idev)
> +{
> + u32 hz, mode, cfg, div;
> + bool supported;
> + int ret;
> +
> + ret = thc_interrupt_quiesce(idev->thc, true);
> + if (ret)
> + return ret;
> +
> + ret = thc_port_select(idev->thc, THC_PORT_TYPE_SPI);
> + if (ret)
> + return ret;
> +
> + ret = thc_port_supported(idev->thc, &supported);
> + if (ret)
> + return ret;
> + if (!supported)
> + return -ENODEV;
[ ... ]
> + ret = thc_port_reset(idev->thc, false);
> + if (ret)
> + return ret;
> +
> + /* Out of reset from here: a teardown has to put it back. */
> + WRITE_ONCE(idev->state, THC_IPTS_RESET);
[ ... ]
> + ret = thc_interrupt_quiesce(idev->thc, false);
> + if (ret)
> + return ret;
> +
> + ret = thc_ipts_touch_set(idev, true);
> + if (ret)
> + return ret;
> + WRITE_ONCE(idev->state, THC_IPTS_CONFIG);
> +
> + return 0;
> +}
> +
> +/**
> + * thc_ipts_port_stop - tear one port down
> + * @idev: port to stop
> + */
> +void thc_ipts_port_stop(struct thc_ipts *idev)
> +{
> + if (READ_ONCE(idev->state) >= THC_IPTS_CONFIG)
> + thc_ipts_touch_set(idev, false);
> +
> + /* Keep the touch IC in reset until the next start. */
> + thc_port_reset(idev->thc, true);
> + thc_interrupt_quiesce(idev->thc, true);
> + WRITE_ONCE(idev->state, THC_IPTS_DOWN);
> +}
[Severity: Medium]
Should thc_ipts_port_stop() check idev->state before calling
thc_port_reset() and thc_interrupt_quiesce()?
thc_ipts_probe() calls thc_ipts_port_stop() whenever thc_ipts_port_start()
fails. If thc_ipts_port_start() returns early before releasing reset
(such as -ENODEV when !supported), idev->state is still THC_IPTS_DOWN, yet
thc_ipts_port_stop() still asserts DEVRST on the port. Similarly, because
thc_ipts_port_start() quiesces interrupts on entry and only unquiesces
them right before THC_IPTS_CONFIG, any failure in between causes
thc_ipts_port_stop() to call thc_interrupt_quiesce(idev->thc, true) on an
already-quiesced controller, triggering the "THC interrupt already
quiesce" dev_warn() in thc_interrupt_quiesce().
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796215044.git.emfox@debian.org?part=2
next prev parent reply other threads:[~2026-12-03 2:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 2:04 [PATCH v11 0/6] HID: intel-thc-hid: intel-ipts: support THC IPTS ports Emfox Zhou
2026-12-03 2:04 ` [PATCH v11 1/6] HID: intel-thc-hid: intel-thc: expose the port operations IPTS needs Emfox Zhou
2026-12-03 2:11 ` sashiko-bot
2026-12-03 2:04 ` [PATCH v11 2/6] HID: intel-thc-hid: intel-ipts: bring up the port Emfox Zhou
2026-12-03 2:15 ` sashiko-bot [this message]
2026-12-03 2:04 ` [PATCH v11 3/6] HID: intel-thc-hid: intel-ipts: receive reports Emfox Zhou
2026-12-03 2:26 ` sashiko-bot
2026-12-03 2:04 ` [PATCH v11 4/6] HID: intel-thc-hid: intel-ipts: add the HID device Emfox Zhou
2026-12-03 2:04 ` [PATCH v11 5/6] HID: intel-thc-hid: intel-ipts: handle system sleep Emfox Zhou
2026-12-03 2:04 ` [PATCH v11 6/6] HID: intel-thc-hid: intel-ipts: document the IPTS mode Emfox Zhou
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-246979@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=emfox@debian.org \
--cc=linux-input@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 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.