Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Qianhui Xu" <xiaqinghuan@mail.ustc.edu.cn>
Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH 3/7] Input: novatek-nvt-ts - add SPI bus support
Date: Wed, 02 Dec 2026 00:44:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-244522@kernel.org> (raw)
In-Reply-To: <20261202003159.1321846-3-xiaqinghuan@mail.ustc.edu.cn>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] Input: novatek-nvt-ts: NULL deref in suspend/resume due to
  unset drvdata
- [Medium] Input: novatek-nvt-ts: broken ID-table match data lookup in
  nvt_ts_probe()
--

commit 65e783365c06ee1cad22c37ad9595fc2e94f4d65
Author: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>

Input: novatek-nvt-ts - add SPI bus support

This commit builds the Novatek NVT touchscreen core as a separate module
and adds an SPI bus driver sharing that core.

> diff --git a/drivers/input/touchscreen/novatek-nvt-ts-spi.c b/drivers/input/touchscreen/novatek-nvt-ts-spi.c
> new file mode 100644
> index 0000000000000..42c02f99f50cd
> --- /dev/null
> +++ b/drivers/input/touchscreen/novatek-nvt-ts-spi.c
> @@ -0,0 +1,71 @@

[ ... ]

> +static int nvt_ts_spi_probe(struct spi_device *spi)
> +{
> +	return nvt_ts_probe(&spi->dev, &nvt_ts_spi_bus_ops, spi->irq, BUS_SPI,
> +			    dev_name(&spi->dev));
> +}
> +
> +static const struct of_device_id nvt_ts_spi_of_match[] = {
> +	{ .compatible = "novatek,nt11205-ts", .data = &nvt_nt11205_ts_data },
> +	{ .compatible = "novatek,nt36672a-ts", .data = &nvt_nt36672a_ts_data },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, nvt_ts_spi_of_match);
> +
> +static const struct spi_device_id nvt_ts_spi_id[] = {
> +	{ .name = "nt11205-ts", .driver_data = (unsigned long)&nvt_nt11205_ts_data },
> +	{ .name = "nt36672a-ts", .driver_data = (unsigned long)&nvt_nt36672a_ts_data },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(spi, nvt_ts_spi_id);

[Severity: Medium]
Will devices matched through nvt_ts_spi_id fail to probe with -EINVAL?

nvt_ts_probe() looks up the chip data with device_get_match_data(dev),
which only queries OF and ACPI fwnode match tables and returns NULL for
spi_device_id matches (unlike spi_get_device_match_data()).

> +
> +static DEFINE_SIMPLE_DEV_PM_OPS(nvt_ts_spi_pm_ops, nvt_ts_suspend, nvt_ts_resume);

[Severity: High]
Does system suspend or resume trigger a NULL pointer dereference in
nvt_ts_suspend() and nvt_ts_resume()?

drivers/input/touchscreen/novatek-nvt-ts-core.c:nvt_ts_suspend() {
	struct nvt_ts_data *data = dev_get_drvdata(dev);

	guard(mutex)(&data->input->mutex);
    ...
}

nvt_ts_probe() calls input_set_drvdata(input, data), which sets driver_data
on &input->dev, but never calls dev_set_drvdata(dev, data) on the bus
device (&spi->dev).  When the PM callbacks run for &spi->dev,
dev_get_drvdata(dev) returns NULL and accessing data->input crashes.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202003159.1321846-1-xiaqinghuan@mail.ustc.edu.cn?part=3

  parent reply	other threads:[~2026-12-02  0:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  0:31 [PATCH 1/7] Input: novatek-nvt-ts - add transport ops abstraction Qianhui Xu
2026-12-02  0:31 ` [PATCH 2/7] Input: novatek-nvt-ts - split bus independent core out Qianhui Xu
2026-12-02  0:38   ` sashiko-bot
     [not found] ` <20261202003159.1321846-3-xiaqinghuan@mail.ustc.edu.cn>
2026-12-02  0:44   ` sashiko-bot [this message]
     [not found] ` <20261202003159.1321846-5-xiaqinghuan@mail.ustc.edu.cn>
2026-12-02  0:46   ` [PATCH 5/7] Input: novatek-nvt-ts - add NT36536 packet decoding sashiko-bot
     [not found] ` <20261202003159.1321846-7-xiaqinghuan@mail.ustc.edu.cn>
2026-12-02  0:53   ` [PATCH 7/7] Input: novatek-nvt-ts - add no-flash firmware download sashiko-bot

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-244522@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=xiaqinghuan@mail.ustc.edu.cn \
    /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