From: sashiko-bot@kernel.org
To: "Chao Huang" <958028483@qq.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH] HID: i2c-hid: goodix: Disable VDD on VDDIO enable failure
Date: Wed, 22 Jul 2026 09:47:46 +0000 [thread overview]
Message-ID: <20260722094747.662C21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <tencent_FE1CA7ED99022E1734F8C9CAB538AB477405@qq.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing NULL check on device_get_match_data() return value leads to NULL pointer dereference if the driver is instantiated via sysfs.
--
--- Patch [1]: [PATCH] HID: i2c-hid: goodix: Disable VDD on VDDIO enable failure ---
commit 2325dfd5a42520477bfee927eabe09ddf852ba83
Author: Chao Huang <huangchao@kylinos.cn>
Subject: HID: i2c-hid: goodix: Disable VDD on VDDIO enable failure
This commit prevents a regulator enable count imbalance during device power up.
It disables the VDD regulator if enabling the VDDIO regulator fails.
> diff --git a/drivers/hid/i2c-hid/i2c-hid-of-goodix.c b/drivers/hid/i2c-hid/i2c-hid-of-goodix.c
> index f1597ad67e7c8..f4dbcd1d1d472 100644
> --- a/drivers/hid/i2c-hid/i2c-hid-of-goodix.c
> +++ b/drivers/hid/i2c-hid/i2c-hid-of-goodix.c
> @@ -51,8 +51,10 @@ static int goodix_i2c_hid_power_up(struct i2chid_ops *ops)
> return ret;
>
> ret = regulator_enable(ihid_goodix->vddio);
> - if (ret)
> + if (ret) {
> + regulator_disable(ihid_goodix->vdd);
> return ret;
> + }
>
> if (ihid_goodix->timings->post_power_delay_ms)
[Severity: High]
This is a pre-existing issue, but can this lead to a NULL pointer
dereference if the driver is instantiated via the I2C sysfs new_device
interface?
In i2c_hid_of_goodix_probe(), the driver unconditionally assigns the
result of device_get_match_data() to ihid_goodix->timings:
drivers/hid/i2c-hid/i2c-hid-of-goodix.c:i2c_hid_of_goodix_probe() {
...
ihid_goodix->timings = device_get_match_data(&client->dev);
...
}
When created via sysfs (e.g., echo gt7375p 0x12 > new_device), the device
lacks an OF/fwnode, so device_get_match_data() returns NULL.
Does this cause a crash when ihid_goodix->timings is subsequently
dereferenced here in goodix_i2c_hid_power_up()?
> msleep(ihid_goodix->timings->post_power_delay_ms);
--
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_FE1CA7ED99022E1734F8C9CAB538AB477405@qq.com?part=1
next prev parent reply other threads:[~2026-07-22 9:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 9:36 [PATCH] HID: i2c-hid: goodix: Disable VDD on VDDIO enable failure Chao Huang
2026-07-22 9:47 ` sashiko-bot [this message]
2026-07-31 17:08 ` Doug Anderson
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=20260722094747.662C21F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=958028483@qq.com \
--cc=dmitry.torokhov@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox