Input: cyapa - fix variable being dereferenced before check
authorDudley Du <dudl@cypress.com>
Thu, 22 Jan 2015 16:17:16 +0000 (08:17 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 22 Jan 2015 16:23:14 +0000 (08:23 -0800)
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>
drivers/input/mouse/cyapa_gen5.c

index 9a4a422afc2a401b0964eddc73e10c01b2694a42..ddf5393a118098fc87337d34e3808c0cfc28ce95 100644 (file)
@@ -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,