diff options
Diffstat (limited to 'drivers/input/touchscreen/atmel_mxt_ts.c')
-rw-r--r-- | drivers/input/touchscreen/atmel_mxt_ts.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index dd2577b796a..99d5210c7ae 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c | |||
@@ -655,7 +655,8 @@ static int mxt_check_reg_init(struct mxt_data *data) | |||
655 | struct mxt_object *object; | 655 | struct mxt_object *object; |
656 | struct device *dev = &data->client->dev; | 656 | struct device *dev = &data->client->dev; |
657 | int index = 0; | 657 | int index = 0; |
658 | int i, j, config_offset; | 658 | int i, size; |
659 | int ret; | ||
659 | 660 | ||
660 | if (!pdata->config) { | 661 | if (!pdata->config) { |
661 | dev_dbg(dev, "No cfg data defined, skipping reg init\n"); | 662 | dev_dbg(dev, "No cfg data defined, skipping reg init\n"); |
@@ -668,18 +669,17 @@ static int mxt_check_reg_init(struct mxt_data *data) | |||
668 | if (!mxt_object_writable(object->type)) | 669 | if (!mxt_object_writable(object->type)) |
669 | continue; | 670 | continue; |
670 | 671 | ||
671 | for (j = 0; | 672 | size = (object->size + 1) * (object->instances + 1); |
672 | j < (object->size + 1) * (object->instances + 1); | 673 | if (index + size > pdata->config_length) { |
673 | j++) { | 674 | dev_err(dev, "Not enough config data!\n"); |
674 | config_offset = index + j; | 675 | return -EINVAL; |
675 | if (config_offset > pdata->config_length) { | ||
676 | dev_err(dev, "Not enough config data!\n"); | ||
677 | return -EINVAL; | ||
678 | } | ||
679 | mxt_write_object(data, object->type, j, | ||
680 | pdata->config[config_offset]); | ||
681 | } | 676 | } |
682 | index += (object->size + 1) * (object->instances + 1); | 677 | |
678 | ret = __mxt_write_reg(data->client, object->start_address, | ||
679 | size, &pdata->config[index]); | ||
680 | if (ret) | ||
681 | return ret; | ||
682 | index += size; | ||
683 | } | 683 | } |
684 | 684 | ||
685 | return 0; | 685 | return 0; |