Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "David Heidelberg via B4 Relay" <devnull+david.ixit.cz@kernel.org>
Cc: conor+dt@kernel.org, robh@kernel.org,
	linux-input@vger.kernel.org, dmitry.torokhov@gmail.com,
	devicetree@vger.kernel.org
Subject: Re: [PATCH WIP v2 08/11] Input: stmfts - add optional reset GPIO support
Date: Thu, 13 Aug 2026 21:42:02 +0000	[thread overview]
Message-ID: <20260813214206.8064D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260315-stmfts5-v2-8-70bc83ee9591@ixit.cz>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [High] The `stmfts_power_on` error path fails to assert the reset GPIO before disabling regulators, creating a back-powering risk.

Pre-existing issues:
- [High] The `stmfts_power_on` error path fails to disable the device interrupt if a failure occurs after the IRQ is enabled.
--

--- Patch [8]: [PATCH WIP v2 08/11] Input: stmfts - add optional reset GPIO support ---
commit af8956cdddb1b976c94ce0f3a47253f42629d7bf
Author: Petr Hodina <petr.hodina@protonmail.com>

Input: stmfts - add optional reset GPIO support
    
Add support for an optional "reset-gpios" property. If present, the
driver drives the reset line high at probe time and releases it during
power-on, after the regulators have been enabled.

> diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c
> index 4dfaf3a6077d9..2c10256e09c5e 100644
> --- a/drivers/input/touchscreen/stmfts.c
> +++ b/drivers/input/touchscreen/stmfts.c

[ ... ]

> @@ -549,6 +559,9 @@ static int stmfts_power_on(struct stmfts_data *sdata)
>  	if (err)
>  		return err;
>  
> +	if (sdata->reset_gpio)
> +		stmfts_reset(sdata);
> +

[Severity: High]
Does this error path properly unwind the reset GPIO state?

If an error occurs later in stmfts_power_on() (for example, if
stmfts_read_system_info() fails), the code jumps to the power_off label:

power_off:
	regulator_bulk_disable(ARRAY_SIZE(stmfts_supplies),
			       sdata->supplies);
	return err;

Since this disables the regulators unconditionally without first reverting the
reset GPIO to its asserted state (as done in stmfts_power_off()), could this
leave the GPIO driving a voltage into an unpowered touchscreen controller?

This could potentially back-power the chip through its internal ESD protection
diodes, risking power leakage or hardware damage.

[Severity: High]
This is a pre-existing issue, but does the power_off label also fail to unwind
the IRQ state if a failure occurs after the IRQ is enabled?

If stmfts_command(sdata, STMFTS_SYSTEM_RESET) fails:

	enable_irq(sdata->client->irq);

	msleep(50);

	err = stmfts_command(sdata, STMFTS_SYSTEM_RESET);
	if (err)
		goto power_off;

The power_off label disables the regulators but fails to call disable_irq().

Could this leak an enabled IRQ line while powering down the device,
potentially triggering an interrupt storm or an IRQ depth imbalance WARN on
subsequent resumes?

>  	/*
>  	 * The datasheet does not specify the power on time, but considering
>  	 * that the reset time is < 10ms, I sleep 20ms to be sure

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260315-stmfts5-v2-0-70bc83ee9591@ixit.cz?part=8

  reply	other threads:[~2026-08-13 21:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-15 18:52 [PATCH WIP v2 00/11] Input: support for STM FTS5 David Heidelberg via B4 Relay
2026-03-15 18:52 ` [PATCH WIP v2 01/11] Input: stmfts - Fix the MODULE_LICENSE() string David Heidelberg via B4 Relay
2026-03-15 18:52 ` [PATCH WIP v2 02/11] Input: stmfts - Use dev struct directly David Heidelberg via B4 Relay
2026-03-15 18:52 ` [PATCH WIP v2 03/11] Input: stmfts - Switch to devm_regulator_bulk_get_const David Heidelberg via B4 Relay
2026-03-15 18:52 ` [PATCH WIP v2 04/11] Input: stmfts - abstract reading information from the firmware David Heidelberg via B4 Relay
2026-03-15 18:52 ` [PATCH WIP v2 05/11] Input: stmfts - disable regulators when power on fails David Heidelberg via B4 Relay
2026-03-15 18:52 ` [PATCH WIP v2 06/11] Input: stmfts - use client to make future code cleaner David Heidelberg via B4 Relay
2026-03-15 18:52 ` [PATCH WIP v2 07/11] dt-bindings: input: touchscreen: st,stmfts: Introduce reset GPIO David Heidelberg via B4 Relay
2026-03-15 18:52 ` [PATCH WIP v2 08/11] Input: stmfts - add optional reset GPIO support David Heidelberg via B4 Relay
2026-08-13 21:42   ` sashiko-bot [this message]
2026-03-15 18:52 ` [PATCH WIP v2 09/11] dt-bindings: input: touchscreen: st,stmfts: Introduce STM FTS5 David Heidelberg via B4 Relay
2026-03-22 10:17   ` Krzysztof Kozlowski
2026-03-15 18:52 ` [PATCH WIP v2 10/11] Input: stmfts - support FTS5 David Heidelberg via B4 Relay
2026-08-13 22:15   ` sashiko-bot
2026-03-15 18:52 ` [PATCH WIP v2 11/11] arm64: dts: qcom: sdm845-google: Add STM FTS touchscreen support David Heidelberg via B4 Relay
2026-03-18 11:49   ` Konrad Dybcio

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=20260813214206.8064D1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=devnull+david.ixit.cz@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=robh@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