Re: [PATCH] Input: tsc2007 - fix resistance calculation when A/D value is saturated

堀井裕樹 <[email protected]> Tue, 12 May 2026 12:23:01 +0900
Newsgroups dev.linux.lists.sashiko,org.kernel.vger.linux-input
Message-ID <CAMARicOm-QwVrBnR+giVjzqfJ4hZP5PwZO7+o9o_SkLhEtxUZw@mail.gmail.com>
Thank you for AI review

> Does this code read uninitialized stack memory? The IIO path initializes
> tc.x, tc.z1, and tc.z2, but it does not initialize tc.y before passing the
> struct to tsc2007_calculate_resistance():

I knew this code existed, but I didn't realize it hadn't been initialized.
I'll fix it.

> Is it safe to return 0 to invalidate the sample?
>
> In tsc2007_soft_irq(), if there is no pendown GPIO, !rt evaluates to true
> and prematurely breaks the polling loop, causing an early pen-up event.

I'll fix it.
In the original code, I had set touch input to be disabled when the
value was 0, but after submitting the patch,
I realized that setting the resistance to infinity—rather than
disabling it at 0—would allow the interrupt handling to continue.