aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/atmel_mxt_ts.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/touchscreen/atmel_mxt_ts.c')
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index d6b64a0fed45..488e3e88c3fc 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -750,6 +750,12 @@ static int mxt_get_object_table(struct mxt_data *data)
750 return 0; 750 return 0;
751} 751}
752 752
753static void mxt_free_object_table(struct mxt_data *data)
754{
755 kfree(data->object_table);
756 data->object_table = NULL;
757}
758
753static int mxt_initialize(struct mxt_data *data) 759static int mxt_initialize(struct mxt_data *data)
754{ 760{
755 struct i2c_client *client = data->client; 761 struct i2c_client *client = data->client;
@@ -772,12 +778,12 @@ static int mxt_initialize(struct mxt_data *data)
772 /* Get object table information */ 778 /* Get object table information */
773 error = mxt_get_object_table(data); 779 error = mxt_get_object_table(data);
774 if (error) 780 if (error)
775 return error; 781 goto err_free_object_table;
776 782
777 /* Check register init values */ 783 /* Check register init values */
778 error = mxt_check_reg_init(data); 784 error = mxt_check_reg_init(data);
779 if (error) 785 if (error)
780 return error; 786 goto err_free_object_table;
781 787
782 mxt_handle_pdata(data); 788 mxt_handle_pdata(data);
783 789
@@ -795,12 +801,12 @@ static int mxt_initialize(struct mxt_data *data)
795 /* Update matrix size at info struct */ 801 /* Update matrix size at info struct */
796 error = mxt_read_reg(client, MXT_MATRIX_X_SIZE, &val); 802 error = mxt_read_reg(client, MXT_MATRIX_X_SIZE, &val);
797 if (error) 803 if (error)
798 return error; 804 goto err_free_object_table;
799 info->matrix_xsize = val; 805 info->matrix_xsize = val;
800 806
801 error = mxt_read_reg(client, MXT_MATRIX_Y_SIZE, &val); 807 error = mxt_read_reg(client, MXT_MATRIX_Y_SIZE, &val);
802 if (error) 808 if (error)
803 return error; 809 goto err_free_object_table;
804 info->matrix_ysize = val; 810 info->matrix_ysize = val;
805 811
806 dev_info(&client->dev, 812 dev_info(&client->dev,
@@ -814,6 +820,10 @@ static int mxt_initialize(struct mxt_data *data)
814 info->object_num); 820 info->object_num);
815 821
816 return 0; 822 return 0;
823
824err_free_object_table:
825 mxt_free_object_table(data);
826 return error;
817} 827}
818 828
819static void mxt_calc_resolution(struct mxt_data *data) 829static void mxt_calc_resolution(struct mxt_data *data)
@@ -1000,8 +1010,7 @@ static ssize_t mxt_update_fw_store(struct device *dev,
1000 /* Wait for reset */ 1010 /* Wait for reset */
1001 msleep(MXT_FWRESET_TIME); 1011 msleep(MXT_FWRESET_TIME);
1002 1012
1003 kfree(data->object_table); 1013 mxt_free_object_table(data);
1004 data->object_table = NULL;
1005 1014
1006 mxt_initialize(data); 1015 mxt_initialize(data);
1007 } 1016 }
@@ -1128,7 +1137,7 @@ static int __devinit mxt_probe(struct i2c_client *client,
1128 1137
1129 error = mxt_initialize(data); 1138 error = mxt_initialize(data);
1130 if (error) 1139 if (error)
1131 goto err_free_object; 1140 goto err_free_mem;
1132 1141
1133 error = request_threaded_irq(client->irq, NULL, mxt_interrupt, 1142 error = request_threaded_irq(client->irq, NULL, mxt_interrupt,
1134 pdata->irqflags, client->name, data); 1143 pdata->irqflags, client->name, data);