* [PATCH] Input: tsc2007 - Read "ti,poll-period" as u32
@ 2026-06-12 21:50 Rob Herring (Arm)
2026-06-12 21:58 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Rob Herring (Arm) @ 2026-06-12 21:50 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
The "ti,poll-period" property is documented as a normal uint32 cell.
The driver used a u64 helper, which makes the helper type disagree with
the schema even though the stored value is still small.
Read "ti,poll-period" with the u32 helper matching the documented DT
cell size.
Assisted-by: Codex:gpt-5-5
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
drivers/input/touchscreen/tsc2007_core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
index 524f14eb3da2..db18b712999d 100644
--- a/drivers/input/touchscreen/tsc2007_core.c
+++ b/drivers/input/touchscreen/tsc2007_core.c
@@ -224,7 +224,6 @@ static int tsc2007_get_pendown_state_gpio(struct device *dev)
static int tsc2007_probe_properties(struct device *dev, struct tsc2007 *ts)
{
u32 val32;
- u64 val64;
if (!device_property_read_u32(dev, "ti,max-rt", &val32))
ts->max_rt = val32;
@@ -240,8 +239,8 @@ static int tsc2007_probe_properties(struct device *dev, struct tsc2007 *ts)
if (!device_property_read_u32(dev, "ti,fuzzz", &val32))
ts->fuzzz = val32;
- if (!device_property_read_u64(dev, "ti,poll-period", &val64))
- ts->poll_period = msecs_to_jiffies(val64);
+ if (!device_property_read_u32(dev, "ti,poll-period", &val32))
+ ts->poll_period = msecs_to_jiffies(val32);
else
ts->poll_period = msecs_to_jiffies(1);
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Input: tsc2007 - Read "ti,poll-period" as u32
2026-06-12 21:50 [PATCH] Input: tsc2007 - Read "ti,poll-period" as u32 Rob Herring (Arm)
@ 2026-06-12 21:58 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-06-12 21:58 UTC (permalink / raw)
Cc: dmitry.torokhov, linux-input
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] A 'ti,poll-period' value of 0 causes an infinite polling loop in tsc2007_soft_irq().
--
commit dfcc8705b785de318165f57112a4d5c957e4ec74
Author: Rob Herring (Arm) <robh@kernel.org>
Input: tsc2007 - Read "ti,poll-period" as u32
The "ti,poll-period" property is documented as a normal uint32 cell.
The driver used a u64 helper, which makes the helper type disagree with
the schema even though the stored value is still small.
Read "ti,poll-period" with the u32 helper matching the documented DT
cell size.
> diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
> --- a/drivers/input/touchscreen/tsc2007_core.c
> +++ b/drivers/input/touchscreen/tsc2007_core.c
[ ... ]
> @@ -238,8 +237,8 @@ static int tsc2007_probe_properties(struct device *dev, struct tsc2007 *ts)
> if (!device_property_read_u32(dev, "ti,fuzzz", &val32))
> ts->fuzzz = val32;
>
> - if (!device_property_read_u64(dev, "ti,poll-period", &val64))
> - ts->poll_period = msecs_to_jiffies(val64);
> + if (!device_property_read_u32(dev, "ti,poll-period", &val32))
> + ts->poll_period = msecs_to_jiffies(val32);
[Severity: High]
Does this change unintentionally allow ts->poll_period to become 0, leading to
an infinite loop in tsc2007_soft_irq()?
Previously, if a 32-bit zero value was provided in the device tree,
device_property_read_u64() would fail due to a length mismatch, triggering
the fallback to a safe 1 jiffy (ts->poll_period = msecs_to_jiffies(1)).
With this fix, a 32-bit zero is successfully parsed, setting
ts->poll_period = 0.
If ts->poll_period is 0, wait_event_timeout(ts->wait, ts->stopped,
ts->poll_period) in tsc2007_soft_irq() evaluates the timeout as 0 and returns
immediately without sleeping. This results in the thread spinning in a tight
loop as long as the touchscreen is pressed.
Should we sanitize a 0 value here so it defaults to 1?
> else
> ts->poll_period = msecs_to_jiffies(1);
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260612215033.1885245-1-robh@kernel.org?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-12 21:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-12 21:50 [PATCH] Input: tsc2007 - Read "ti,poll-period" as u32 Rob Herring (Arm)
2026-06-12 21:58 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox