From: Jiada Wang <jiada_wang@mentor.com>
To: <nick@shmanahar.org>, <dmitry.torokhov@gmail.com>
Cc: <linux-input@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<jiada_wang@mentor.com>, <george_davis@mentor.com>
Subject: [PATCH v1 34/63] Input: atmel_mxt_ts - Change call-points of mxt_free_* functions
Date: Fri, 16 Aug 2019 17:34:22 +0900 [thread overview]
Message-ID: <20190816083451.18947-5-jiada_wang@mentor.com> (raw)
In-Reply-To: <20190816083451.18947-1-jiada_wang@mentor.com>
From: Kautuk Consul <kautuk_consul@mentor.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@mentor.com>
Signed-off-by: George G. Davis <george_davis@mentor.com>
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 248d4b239bf6..aa913d2a0e3b 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -3328,21 +3328,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");
}
@@ -3350,10 +3350,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 */
@@ -4142,11 +4138,13 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
error = mxt_initialize(data);
if (error)
- goto err_sysfs_remove_group;
+ goto err_free_object;
return 0;
-err_sysfs_remove_group:
+err_free_object:
+ mxt_free_input_device(data);
+ mxt_free_object_table(data);
sysfs_remove_group(&client->dev.kobj, &mxt_fw_attr_group);
return error;
}
--
2.19.2
prev parent reply other threads:[~2019-08-16 8:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-16 8:34 [PATCH v1 30/63] Input: atmel_mxt_ts - implement debug output for messages Jiada Wang
2019-08-16 8:34 ` [PATCH v1 31/63] Input: atmel_mxt_ts - add memory access interface via sysfs Jiada Wang
2019-08-16 17:29 ` Dmitry Torokhov
2019-08-23 3:00 ` Jiada Wang
2019-08-16 8:34 ` [PATCH v1 32/63] Input: atmel_mxt_ts - implement improved debug message interface Jiada Wang
2019-08-16 8:34 ` [PATCH v1 33/63] Input: atmel_mxt_ts - eliminate data->raw_info_block Jiada Wang
2019-08-16 8:34 ` Jiada Wang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190816083451.18947-5-jiada_wang@mentor.com \
--to=jiada_wang@mentor.com \
--cc=dmitry.torokhov@gmail.com \
--cc=george_davis@mentor.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nick@shmanahar.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).