Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH] Input: cyttsp5 - Use dev_err_probe() to hide EPROBE_DEFER
@ 2026-11-19 18:34 Andreas Kemnade
  2026-11-19 18:40 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Kemnade @ 2026-11-19 18:34 UTC (permalink / raw)
  To: Linus Walleij, Dmitry Torokhov; +Cc: linux-input, linux-kernel, Andreas Kemnade

Use dev_error_probe() to avoid unnecessary noise if prerequisites
are not ready like the regulators.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
 drivers/input/touchscreen/cyttsp5.c | 33 +++++++++++----------------------
 1 file changed, 11 insertions(+), 22 deletions(-)

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
@@ -844,20 +844,16 @@ static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq,
 	ts->supplies[1].supply = "vddio";
 	error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->supplies),
 					ts->supplies);
-	if (error) {
-		dev_err(ts->dev, "Failed to get regulators, error %d\n", error);
-		return error;
-	}
+	if (error)
+		return dev_err_probe(ts->dev, error, "Failed to get regulators\n");
 
 	error = devm_add_action_or_reset(dev, cyttsp5_cleanup, ts);
 	if (error)
 		return error;
 
 	error = regulator_bulk_enable(ARRAY_SIZE(ts->supplies), ts->supplies);
-	if (error) {
-		dev_err(ts->dev, "Failed to enable regulators, error %d\n", error);
-		return error;
-	}
+	if (error)
+		return dev_err_probe(ts->dev, error, "Failed to enable regulators\n");
 
 	ts->input = devm_input_allocate_device(dev);
 	if (!ts->input) {
@@ -874,8 +870,7 @@ static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq,
 	ts->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(ts->reset_gpio)) {
 		error = PTR_ERR(ts->reset_gpio);
-		dev_err(dev, "Failed to request reset gpio, error %d\n", error);
-		return error;
+		return dev_err_probe(dev, error, "Failed to request reset gpio\n");
 	}
 
 	fsleep(10); /* Ensure long-enough reset pulse (minimum 10us). */
@@ -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");
 
 	error = cyttsp5_parse_dt_key_code(dev);
-	if (error < 0) {
-		dev_err(ts->dev, "Error while parsing dts %d\n", error);
-		return error;
-	}
+	if (error < 0)
+		return dev_err_probe(ts->dev, error, "Error while parsing dts\n");
 
 	touchscreen_parse_properties(ts->input, true, &ts->prop);
 

---
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
change-id: 20261119-cyt-errporbe-6b6278a09b3b

Best regards,
--  
Andreas Kemnade <andreas@kemnade.info>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Input: cyttsp5 - Use dev_err_probe() to hide EPROBE_DEFER
  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
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-19 18:40 UTC (permalink / raw)
  To: Andreas Kemnade; +Cc: linux-input, dmitry.torokhov

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-19 18:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox