From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D65BC4CEC9 for ; Tue, 17 Sep 2019 09:41:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E34121881 for ; Tue, 17 Sep 2019 09:41:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728945AbfIQJlP (ORCPT ); Tue, 17 Sep 2019 05:41:15 -0400 Received: from esa2.mentor.iphmx.com ([68.232.141.98]:19904 "EHLO esa2.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727469AbfIQJlN (ORCPT ); Tue, 17 Sep 2019 05:41:13 -0400 IronPort-SDR: 7VmPV8HDN59+teplCLJ81bLqsC9ive63rpjybI75YFpnYc6yc8JKZGm+zctGNLKE40uaBemzq6 EGRKyqfXdimW3NaPPVVmv3sqkvAAZvLaqnDtlhxCXCpJ/VQF2AV7Uu/ucm3JTeS8zW6HRDu+fD /eiwckeGGhRPWx4Gvb8KJtf6X9FPOUPZm7oIXbbNUcc8+E+bJGu6JK/UqbCtXCVR2QZDzwfcjN F4oMOrIAxoD7dcL0byOEP6LLjFOGjOSrN8TsL7JwXhVgUfGmam6BSoZMH5Vye000Nqxrw4DRro Y4Y= X-IronPort-AV: E=Sophos;i="5.64,515,1559548800"; d="scan'208";a="41374173" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 17 Sep 2019 01:41:13 -0800 IronPort-SDR: 9W69aUxy6R+McONLr2BNHxRXhOEL3y4cLV9jEV7pMY/DEy1EfWGjeu8QkO4V4JlLQhhNqMlAjX NaHH3sIgb4qfwDPJjEiFaSa/Ys3yP/npfggM9ywoorggt9R9mTW67b22MSp4NpFBP+z3M0cvrF 7qbkGchS+y1kI2G65MWadtgQF/qin5XwlAqRF1iR/kXcTLNa97BqrftTX+Rij99wtVWb0MU7nq c3RpyQ+Tyi69HQN3mV6LvVvujZcSCy0HYk4DnQxqb97vn499mY2htPUnvNzMBg835SUTBTNmq8 7YY= From: Jiada Wang To: , , , , CC: , , Subject: [PATCH v3 32/49] Input: atmel_mxt_ts - Change call-points of mxt_free_* functions Date: Tue, 17 Sep 2019 18:40:33 +0900 Message-ID: <20190917094050.18771-4-jiada_wang@mentor.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190917094050.18771-1-jiada_wang@mentor.com> References: <20190917094050.18771-1-jiada_wang@mentor.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ClientProxiedBy: SVR-ORW-MBX-05.mgc.mentorg.com (147.34.90.205) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kautuk Consul 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 Signed-off-by: George G. Davis Signed-off-by: Jiada Wang --- 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 560fe8a3bf62..e441eab8b201 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -3339,21 +3339,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"); } @@ -3361,10 +3361,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 */ @@ -4101,16 +4097,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.19.2