aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2014-08-11 13:58:29 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2014-08-13 12:16:11 -0400
commit041fa15951d0fb349d24c5619f35de1878bd030e (patch)
tree6154947c7d5f2bc74f1074360ba0b8ad9a09d389 /drivers/input
parentefdbd7ae44f35cbb2b29d825640b917723319f7b (diff)
Input: atmel_mxt_ts - fix a few issues reported by Coverity
This should fix the following issues reported by Coverity: *** CID 1230625: Logically dead code (DEADCODE) /drivers/input/touchscreen/atmel_mxt_ts.c: 1692 in mxt_initialize() *** CID 1230627: Missing break in switch (MISSING_BREAK) /drivers/input/touchscreen/atmel_mxt_ts.c: 1436 in mxt_get_object_table() *** CID 1230629: Out-of-bounds write (OVERRUN) /drivers/input/touchscreen/atmel_mxt_ts.c: 1267 in mxt_update_cfg() *** CID 1230632: Unused pointer value (UNUSED_VALUE) /drivers/input/touchscreen/atmel_mxt_ts.c: 1211 in mxt_update_cfg() Acked-by: Nick Dyer <nick.dyer@itdev.co.uk> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index bbaf3ff680ed..db178ed2b47e 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -1098,8 +1098,12 @@ static int mxt_prepare_cfg_mem(struct mxt_data *data,
1098 /* Skip object */ 1098 /* Skip object */
1099 for (i = 0; i < size; i++) { 1099 for (i = 0; i < size; i++) {
1100 ret = sscanf(cfg->data + data_pos, "%hhx%n", 1100 ret = sscanf(cfg->data + data_pos, "%hhx%n",
1101 &val, 1101 &val, &offset);
1102 &offset); 1102 if (ret != 1) {
1103 dev_err(dev, "Bad format in T%d at %d\n",
1104 type, i);
1105 return -EINVAL;
1106 }
1103 data_pos += offset; 1107 data_pos += offset;
1104 } 1108 }
1105 continue; 1109 continue;
@@ -1139,7 +1143,8 @@ static int mxt_prepare_cfg_mem(struct mxt_data *data,
1139 &val, 1143 &val,
1140 &offset); 1144 &offset);
1141 if (ret != 1) { 1145 if (ret != 1) {
1142 dev_err(dev, "Bad format in T%d\n", type); 1146 dev_err(dev, "Bad format in T%d at %d\n",
1147 type, i);
1143 return -EINVAL; 1148 return -EINVAL;
1144 } 1149 }
1145 data_pos += offset; 1150 data_pos += offset;
@@ -1149,8 +1154,7 @@ static int mxt_prepare_cfg_mem(struct mxt_data *data,
1149 1154
1150 byte_offset = reg + i - cfg_start_ofs; 1155 byte_offset = reg + i - cfg_start_ofs;
1151 1156
1152 if (byte_offset >= 0 && 1157 if (byte_offset >= 0 && byte_offset < config_mem_size) {
1153 byte_offset <= config_mem_size) {
1154 *(config_mem + byte_offset) = val; 1158 *(config_mem + byte_offset) = val;
1155 } else { 1159 } else {
1156 dev_err(dev, "Bad object: reg:%d, T%d, ofs=%d\n", 1160 dev_err(dev, "Bad object: reg:%d, T%d, ofs=%d\n",
@@ -1454,6 +1458,7 @@ static int mxt_get_object_table(struct mxt_data *data)
1454 data->T5_msg_size = mxt_obj_size(object) - 1; 1458 data->T5_msg_size = mxt_obj_size(object) - 1;
1455 } 1459 }
1456 data->T5_address = object->start_address; 1460 data->T5_address = object->start_address;
1461 break;
1457 case MXT_GEN_COMMAND_T6: 1462 case MXT_GEN_COMMAND_T6:
1458 data->T6_reportid = min_id; 1463 data->T6_reportid = min_id;
1459 data->T6_address = object->start_address; 1464 data->T6_address = object->start_address;
@@ -1707,7 +1712,7 @@ static int mxt_initialize(struct mxt_data *data)
1707 return error; 1712 return error;
1708 } 1713 }
1709 1714
1710 mxt_acquire_irq(data); 1715 error = mxt_acquire_irq(data);
1711 if (error) 1716 if (error)
1712 goto err_free_object_table; 1717 goto err_free_object_table;
1713 1718