From: Geert Uytterhoeven Date: Mon, 2 Mar 2015 17:39:24 +0000 (-0800) Subject: Input: cyapa - remove superfluous type check in cyapa_gen5_read_idac_data() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2523caab3ce98ddd8a3eaf76eadd941dae5fb57e;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git Input: cyapa - remove superfluous type check in cyapa_gen5_read_idac_data() drivers/input/mouse/cyapa_gen5.c: In function ‘cyapa_gen5_read_idac_data’: drivers/input/mouse/cyapa_gen5.c:1876: warning: ‘max_element_cnt’ may be used uninitialized in this function drivers/input/mouse/cyapa_gen5.c:1873: warning: ‘offset’ may be used uninitialized in this function If *data_size is non-zero, and idac_data_type contains an unknown type, max_element_cnt and offset will be uninitialized, and the loop will process non-existing data. However, this cannot happen (for now), as there's a test for unknown types at the top of cyapa_gen5_read_idac_data(). As no "if ... else if ..." is used in other places, remove the superfluous "if" to silence the compiler warning. Signed-off-by: Geert Uytterhoeven Acked-by: Dudley Du Signed-off-by: Dmitry Torokhov --- diff --git a/drivers/input/mouse/cyapa_gen5.c b/drivers/input/mouse/cyapa_gen5.c index aa68edd46b76..5b611dd71e79 100644 --- a/drivers/input/mouse/cyapa_gen5.c +++ b/drivers/input/mouse/cyapa_gen5.c @@ -1926,7 +1926,7 @@ static int cyapa_gen5_read_idac_data(struct cyapa *cyapa, electrodes_tx = cyapa->electrodes_x; max_element_cnt = ((cyapa->aligned_electrodes_rx + 7) & ~7u) * electrodes_tx; - } else if (idac_data_type == GEN5_RETRIEVE_SELF_CAP_PWC_DATA) { + } else { offset = 2; max_element_cnt = cyapa->electrodes_x + cyapa->electrodes_y;