All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andreas Kemnade" <andreas@kemnade.info>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH] Input: cyttsp5 - Use dev_err_probe() to hide EPROBE_DEFER
Date: Thu, 19 Nov 2026 18:40:33 +0000	[thread overview]
Message-ID: <sashiko-outbox-223799@kernel.org> (raw)
In-Reply-To: <20261119-cyt-errporbe-v1-1-7faa44e821b4@kemnade.info>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] Input: cyttsp5 - concurrent regmap reads in cyttsp5_probe() [1]
--

commit c1590d49f726ba5943ef8a369ba24293879c0745
Author: Andreas Kemnade <andreas@kemnade.info>

Input: cyttsp5 - Use dev_err_probe() to hide EPROBE_DEFER

This commit replaces dev_err() calls in cyttsp5_probe() with
dev_err_probe() to suppress error messages on deferred probe.

> diff --git a/drivers/input/touchscreen/cyttsp5.c b/drivers/input/touchscreen/cyttsp5.c
> index d4a78facfa815..82209bfdf828d 100644
> --- a/drivers/input/touchscreen/cyttsp5.c
> +++ b/drivers/input/touchscreen/cyttsp5.c

[ ... ]

> @@ -887,22 +882,16 @@ static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq,
>  
>  	error = devm_request_threaded_irq(dev, irq, NULL, cyttsp5_handle_irq,
>  					  IRQF_ONESHOT, name, ts);
> -	if (error) {
> -		dev_err(dev, "unable to request IRQ\n");
> -		return error;
> -	}
> +	if (error)
> +		return dev_err_probe(dev, error, "unable to request IRQ\n");
>  
>  	error = cyttsp5_startup(ts);
> -	if (error) {
> -		dev_err(ts->dev, "Fail initial startup r=%d\n", error);
> -		return error;
> -	}
> +	if (error)
> +		return dev_err_probe(ts->dev, error, "Fail initial startup\n");

[Severity: High]
This problem wasn't introduced by this patch, but can cyttsp5_handle_irq()
race with cyttsp5_startup() on HID_INPUT_REG reads [1]?

devm_request_threaded_irq() unmasks the interrupt before cyttsp5_startup()
runs.  If a pending event or touch triggers the IRQ immediately, both paths
perform unserialized regmap_bulk_read() transfers against HID_INPUT_REG:

CPU0                              CPU1
cyttsp5_probe()
  devm_request_threaded_irq()
                                  cyttsp5_handle_irq()
                                    cyttsp5_read()
                                      regmap_bulk_read() /* read size */
  cyttsp5_startup()
    cyttsp5_deassert_int()
      regmap_bulk_read()          <-- interleaves with two-step read
                                      regmap_bulk_read() /* read data */

This corrupts the sequential HID report read protocol.  In addition, if
cyttsp5_deassert_int() reads a non-empty touch report (size > 2), it returns
-EINVAL and aborts probe:

drivers/input/touchscreen/cyttsp5.c:cyttsp5_deassert_int() {
	...
	error = regmap_bulk_read(ts->regmap, HID_INPUT_REG, buf, sizeof(buf));
	if (error < 0)
		return error;

	size = get_unaligned_le16(&buf[0]);
	if (size == 2 || size == 0)
		return 0;

	return -EINVAL;
}

[1] https://sashiko.dev/#/bug/linux-bab102b6-93cb-4ea5-b362-6d8c8b8866ea

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119-cyt-errporbe-v1-1-7faa44e821b4@kemnade.info?part=1

      reply	other threads:[~2026-11-19 18:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 18:34 [PATCH] Input: cyttsp5 - Use dev_err_probe() to hide EPROBE_DEFER Andreas Kemnade
2026-11-19 18:40 ` sashiko-bot [this message]

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-223799@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=andreas@kemnade.info \
    --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 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.