[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200508055656.96389-40-jiada_wang@mentor.com>
Date: Thu, 7 May 2020 22:56:39 -0700
From: Jiada Wang <jiada_wang@...tor.com>
To: <nick@...anahar.org>, <dmitry.torokhov@...il.com>,
<jikos@...nel.org>, <benjamin.tissoires@...hat.com>,
<bsz@...ihalf.com>
CC: <linux-input@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<erosca@...adit-jv.com>, <Andrew_Gabbasov@...tor.com>,
<jiada_wang@...tor.com>
Subject: [PATCH v11 39/56] Input: atmel_mxt_ts - Change call-points of mxt_free_* functions
From: Kautuk Consul <kautuk_consul@...tor.com>
Revamping the code to call mxt_free_object_table and mxt_free_input_device
functions only in the following scenarios and code paths:
1) The error path of the mxt_probe() entry point
2) The mxt_remove de-init path entry point
3) All paths which definitely expect to populate the object table
like:
- the mxt_update_fw_store path which first calls
mxt_load_fw and then resorts to calling mxt_initialize itself.
- the mxt_read_info_block function which attempts to fill in the
object table itself as the main non-error part of the logic.
4) All paths in the code expected to definitely allocate and register
the input device such as:
- the mxt_update_fw_store path which first calls
mxt_load_fw and then resorts to calling mxt_initialize itself.
- the mxt_update_cfg_store function which will call
mxt_configure_objects.
Signed-off-by: Kautuk Consul <kautuk_consul@...tor.com>
Signed-off-by: George G. Davis <george_davis@...tor.com>
Signed-off-by: Jiada Wang <jiada_wang@...tor.com>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index a92ad9a103a1..9281a574ca80 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -3317,21 +3317,21 @@ static int mxt_configure_objects(struct mxt_data *data,
error = mxt_init_t7_power_cfg(data);
if (error) {
dev_err(dev, "Failed to initialize power cfg\n");
- goto err_free_object_table;
+ return error;
}
if (cfg) {
error = mxt_update_cfg(data, cfg);
if (error) {
dev_warn(dev, "Error %d updating config\n", error);
- goto err_free_object_table;
+ return error;
}
}
if (data->multitouch) {
error = mxt_initialize_input_device(data);
if (error)
- goto err_free_object_table;
+ return error;
} else {
dev_warn(dev, "No touch object detected\n");
}
@@ -3339,10 +3339,6 @@ static int mxt_configure_objects(struct mxt_data *data,
mxt_debug_init(data);
return 0;
-
-err_free_object_table:
- mxt_free_object_table(data);
- return error;
}
/* Configuration crc check sum is returned as hex xxxxxx */
@@ -4093,16 +4089,21 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
error = mxt_initialize(data);
if (error)
- return error;
+ goto err_free_object;
error = sysfs_create_group(&client->dev.kobj, &mxt_fw_attr_group);
if (error) {
dev_err(&client->dev, "Failure %d creating fw sysfs group\n",
error);
- return error;
+ goto err_free_object;
}
return 0;
+
+err_free_object:
+ mxt_free_input_device(data);
+ mxt_free_object_table(data);
+ return error;
}
static int mxt_remove(struct i2c_client *client)
--
2.17.1
Powered by blists - more mailing lists