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 2/7] Input: novatek-nvt-ts - split bus independent core out
Date: Wed, 02 Dec 2026 00:38:45 +0000	[thread overview]
Message-ID: <sashiko-outbox-244512@kernel.org> (raw)
In-Reply-To: <20261202003159.1321846-2-xiaqinghuan@mail.ustc.edu.cn>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] Input: missing dev_set_drvdata() in nvt_ts_probe() causes
  suspend NULL deref
--

commit 6091ea62bfff4d047f5416c450fcaedba40ba1e3
Author: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>

Input: novatek-nvt-ts - split bus independent core out

This commit splits the Novatek NVT touchscreen driver into a
bus-independent core and an I2C transport module.

> diff --git a/drivers/input/touchscreen/novatek-nvt-ts.c b/drivers/input/touchscreen/novatek-nvt-ts-core.c
> similarity index 61%
> rename from drivers/input/touchscreen/novatek-nvt-ts.c
> rename to drivers/input/touchscreen/novatek-nvt-ts-core.c
> index d1aa42533db2a..522b5e6131c9e 100644
> --- a/drivers/input/touchscreen/novatek-nvt-ts.c
> +++ b/drivers/input/touchscreen/novatek-nvt-ts-core.c

[ ... ]

> @@ -192,7 +110,7 @@ static void nvt_ts_stop(struct input_dev *dev)
>  	regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators);
>  }
>  
> -static int nvt_ts_suspend(struct device *dev)
> +int nvt_ts_suspend(struct device *dev)
>  {
>  	struct nvt_ts_data *data = dev_get_drvdata(dev);
>  
> @@ -204,7 +122,7 @@ static int nvt_ts_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int nvt_ts_resume(struct device *dev)
> +int nvt_ts_resume(struct device *dev)
>  {
>  	struct nvt_ts_data *data = dev_get_drvdata(dev);
>  
> @@ -216,17 +134,15 @@ static int nvt_ts_resume(struct device *dev)
>  	return 0;
>  }
>  
> -static DEFINE_SIMPLE_DEV_PM_OPS(nvt_ts_pm_ops, nvt_ts_suspend, nvt_ts_resume);
> -
> -static int nvt_ts_probe(struct i2c_client *client)
> +int nvt_ts_probe(struct device *dev, const struct nvt_ts_bus_ops *bus_ops,
> +		 int irq, unsigned int bustype, const char *name)
>  {
> -	struct device *dev = &client->dev;
>  	int error, width, height, irq_type;
>  	struct nvt_ts_data *data;
>  	const struct nvt_ts_i2c_chip_data *chip;
>  	struct input_dev *input;
>  
> -	if (!client->irq) {
> +	if (!irq) {
>  		dev_err(dev, "Error no irq specified\n");
>  		return -EINVAL;
>  	}
> @@ -235,14 +151,13 @@ static int nvt_ts_probe(struct i2c_client *client)
>  	if (!data)
>  		return -ENOMEM;
>  
> -	chip = device_get_match_data(&client->dev);
> +	chip = device_get_match_data(dev);
>  	if (!chip)
>  		return -EINVAL;
>  
>  	data->dev = dev;
> -	data->bus_ops = &nvt_ts_i2c_bus_ops;
> -	data->irq = client->irq;
> -	i2c_set_clientdata(client, data);
> +	data->bus_ops = bus_ops;
> +	data->irq = irq;

[Severity: High]
Does removing i2c_set_clientdata(client, data) without calling
dev_set_drvdata(dev, data) cause a NULL pointer dereference in
nvt_ts_suspend() and nvt_ts_resume()?

nvt_ts_suspend() and nvt_ts_resume() fetch data via dev_get_drvdata(dev)
and immediately access &data->input->mutex, while input_set_drvdata(input,
data) later in nvt_ts_probe() only sets driver data on the child input
device.

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

  reply	other threads:[~2026-12-02  0:38 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 [this message]
     [not found] ` <20261202003159.1321846-3-xiaqinghuan@mail.ustc.edu.cn>
2026-12-02  0:44   ` [PATCH 3/7] Input: novatek-nvt-ts - add SPI bus support sashiko-bot
     [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-244512@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