Input: iqs7222 - protect against undefined slider size
authorJeff LaBundy <jeff@labundy.com>
Sun, 23 Oct 2022 00:57:00 +0000 (19:57 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:03 +0000 (13:32 +0100)
commita7e8439e297ef3b08b1a9455b8c355b7fa446987
tree79145fc22bc113de7f2e9ed56071640f02e32ecb
parent172d4d64075075f955e6e416915e3f287eec514a
Input: iqs7222 - protect against undefined slider size

[ Upstream commit 2f6fd232978906f6fb054529210b9faec384bd45 ]

Select variants of silicon do not define a default slider size, in
which case the size must be specified in the device tree. If it is
not, the axis's maximum value is reported as 65535 due to unsigned
integer overflow.

To solve this problem, move the existing zero-check outside of the
conditional block that checks whether the property is present.

Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C")
Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Link: https://lore.kernel.org/r/Y1SRXEi7XMlncDWk@nixie71
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/input/misc/iqs7222.c