From a535a9f16cc39b978857d584d6e5fb9840db7db7 Mon Sep 17 00:00:00 2001 From: Dudley Du Date: Thu, 22 Jan 2015 08:17:16 -0800 Subject: [PATCH] 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 Signed-off-by: Dudley Du Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/cyapa_gen5.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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, -- 2.45.2