aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/cyapa_gen5.c
diff options
context:
space:
mode:
authorDudley Du <dudl@cypress.com>2015-01-22 08:17:16 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-01-22 08:23:14 -0800
commita535a9f16cc39b978857d584d6e5fb9840db7db7 (patch)
treedf71de2d15b5285a7121474fadbc956e103dfbcf /drivers/input/mouse/cyapa_gen5.c
parentInput: cyapa - fix endianness issues in gen5 firmware update support (diff)
downloadlinux-dev-a535a9f16cc39b978857d584d6e5fb9840db7db7.tar.xz
linux-dev-a535a9f16cc39b978857d584d6e5fb9840db7db7.zip
Input: cyapa - fix variable being dereferenced before check
Fixes the warning regarding variable being dereferenced before check 'gen5_pip->resp_len'. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Dudley Du <dudl@cypress.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/mouse/cyapa_gen5.c')
-rw-r--r--drivers/input/mouse/cyapa_gen5.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/input/mouse/cyapa_gen5.c b/drivers/input/mouse/cyapa_gen5.c
index 9a4a422afc2a..ddf5393a1180 100644
--- a/drivers/input/mouse/cyapa_gen5.c
+++ b/drivers/input/mouse/cyapa_gen5.c
@@ -2557,7 +2557,9 @@ static bool cyapa_gen5_irq_cmd_handler(struct cyapa *cyapa)
* trackpad device when booting/rebooting
* their chrome book.
*/
- length = *gen5_pip->resp_len;
+ length = 0;
+ if (gen5_pip->resp_len)
+ length = *gen5_pip->resp_len;
cyapa_empty_pip_output_data(cyapa,
gen5_pip->resp_data,
&length,