]> git.baikalelectronics.ru Git - kernel.git/commit
Input: resistive-adc-touch - fix uninitialized variable 'press'
authorColin Ian King <colin.king@canonical.com>
Sat, 5 Jun 2021 23:09:36 +0000 (16:09 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 5 Jun 2021 23:41:08 +0000 (16:41 -0700)
commitcbf294dc8b989db9de2d8ab7ce0ee555f843cad8
tree3ee7de258477ed057307af98037680ee7ab8a197
parentf2fc7066b03e111777d6392280b381779eb3e0e3
Input: resistive-adc-touch - fix uninitialized variable 'press'

In the case where st->ch_map[GRTS_CH_PRESSURE] < GRTS_MAX_CHANNELS is false
and also st->ch_map[GRTS_CH_Z1] < GRTS_MAX_CHANNELS is false the variable
press is not initialized and contains garbage. In this situation
st->pressure is also false, so we do not actually use press value, but
it is impossible for the compiler to realize this, and it emits
"uninitialized variable" warning. Fix this by initializing press
to 0 and allows us to also remove an else clause that sets press to 0.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: f2792b0f1084 ("Input: resistive-adc-touch - rework mapping of channels")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210603220809.155118-1-colin.king@canonical.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/resistive-adc-touch.c