diff options
author | Nishanth Menon | 2013-08-08 14:48:49 -0500 |
---|---|---|
committer | Praneeth Bajjuri | 2013-08-09 16:11:21 -0500 |
commit | c5444cc3fe1dd3a812d4ec9e2c1890da5040eac6 (patch) | |
tree | f392080d3cf782bf975ebc551e5c8c3dfedb7312 | |
parent | b4f07283cf8d5718ee4b7d003c0057eaec51d24e (diff) | |
download | kernel-audio-c5444cc3fe1dd3a812d4ec9e2c1890da5040eac6.tar.gz kernel-audio-c5444cc3fe1dd3a812d4ec9e2c1890da5040eac6.tar.xz kernel-audio-c5444cc3fe1dd3a812d4ec9e2c1890da5040eac6.zip |
Input: atmel_mxt_ts: switch to using devm_kzalloc
Using managed allocation helps us simplify our probe and cleanup.
Change-Id: I239ddefb4a07c92c902f5460e6da7f0663a877c2
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Sundar Raman <sunds@ti.com>
-rw-r--r-- | drivers/input/touchscreen/atmel_mxt_ts.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 2eaf9955fbb7..7dc24a3b31a5 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c | |||
@@ -1107,7 +1107,7 @@ static int mxt_probe(struct i2c_client *client, | |||
1107 | if (!pdata) | 1107 | if (!pdata) |
1108 | return -EINVAL; | 1108 | return -EINVAL; |
1109 | 1109 | ||
1110 | data = kzalloc(sizeof(struct mxt_data), GFP_KERNEL); | 1110 | data = devm_kzalloc(&client->dev, sizeof(struct mxt_data), GFP_KERNEL); |
1111 | input_dev = input_allocate_device(); | 1111 | input_dev = input_allocate_device(); |
1112 | if (!data || !input_dev) { | 1112 | if (!data || !input_dev) { |
1113 | dev_err(&client->dev, "Failed to allocate memory\n"); | 1113 | dev_err(&client->dev, "Failed to allocate memory\n"); |
@@ -1195,7 +1195,6 @@ err_free_object: | |||
1195 | kfree(data->object_table); | 1195 | kfree(data->object_table); |
1196 | err_free_mem: | 1196 | err_free_mem: |
1197 | input_free_device(input_dev); | 1197 | input_free_device(input_dev); |
1198 | kfree(data); | ||
1199 | return error; | 1198 | return error; |
1200 | } | 1199 | } |
1201 | 1200 | ||
@@ -1206,7 +1205,6 @@ static int mxt_remove(struct i2c_client *client) | |||
1206 | sysfs_remove_group(&client->dev.kobj, &mxt_attr_group); | 1205 | sysfs_remove_group(&client->dev.kobj, &mxt_attr_group); |
1207 | input_unregister_device(data->input_dev); | 1206 | input_unregister_device(data->input_dev); |
1208 | kfree(data->object_table); | 1207 | kfree(data->object_table); |
1209 | kfree(data); | ||
1210 | 1208 | ||
1211 | return 0; | 1209 | return 0; |
1212 | } | 1210 | } |