summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorVenkata Prahlad Valluru <vvalluru@codeaurora.org>2018-03-13 16:46:02 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2018-03-13 20:53:50 -0700
commit741edf0dd64b31459f777588be7d620d226672fc (patch)
tree2283eb3192b4a6525185728a0b3196dc474f007a /drivers/input
parent6feaa135ad5d137f69cd624e17dcd8c809379a29 (diff)
input: touchscreen: Fix uninitialized variable usage in Atmel driver
Initialize variables that are passed by reference, so that they can be used safely afterwards, irrespective of the called function actions. Change-Id: Ib52c1cbc621913b21eb9520d305327ff5fd154fe Signed-off-by: Venkata Prahlad Valluru <vvalluru@codeaurora.org>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/atmel_maxtouch_ts.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/input/touchscreen/atmel_maxtouch_ts.c b/drivers/input/touchscreen/atmel_maxtouch_ts.c
index 9aa57c176d97..712a278c9d1e 100644
--- a/drivers/input/touchscreen/atmel_maxtouch_ts.c
+++ b/drivers/input/touchscreen/atmel_maxtouch_ts.c
@@ -1473,7 +1473,7 @@ static int mxt_t6_command(struct mxt_data *data, u16 cmd_offset,
u8 value, bool wait)
{
u16 reg;
- u8 command_register;
+ u8 command_register = 0;
int timeout_counter = 0;
int ret;
@@ -1578,7 +1578,7 @@ static int mxt_check_retrigen(struct mxt_data *data)
{
struct i2c_client *client = data->client;
int error;
- int val;
+ int val = 0;
if (data->pdata->irqflags & IRQF_TRIGGER_LOW)
return 0;
@@ -1623,9 +1623,11 @@ static int mxt_update_t100_resolution(struct mxt_data *data)
struct i2c_client *client = data->client;
int error;
struct mxt_object *object;
- u16 range_x, range_y, temp;
- u8 cfg, tchaux;
- u8 aux;
+ u16 range_x = 0;
+ u16 range_y = 0;
+ u16 temp;
+ u8 cfg = 0;
+ u8 tchaux, aux;
bool update = false;
object = mxt_get_object(data, MXT_TOUCH_MULTITOUCHSCREEN_T100);
@@ -1664,10 +1666,6 @@ static int mxt_update_t100_resolution(struct mxt_data *data)
if (range_x == 0)
range_x = 1023;
- /* Handle default values */
- if (range_x == 0)
- range_x = 1023;
-
if (range_y == 0)
range_y = 1023;
@@ -1739,8 +1737,8 @@ static int mxt_update_t9_resolution(struct mxt_data *data)
{
struct i2c_client *client = data->client;
int error;
- struct t9_range range;
- unsigned char orient;
+ struct t9_range range = {0};
+ unsigned char orient = 0;
struct mxt_object *object;
u16 temp;
bool update = false;