From patchwork Wed Sep 27 08:10:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13400317 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C25C3210A for ; Wed, 27 Sep 2023 08:10:55 +0000 (UTC) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qlPd8-0007vI-Rl; Wed, 27 Sep 2023 10:10:46 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlPd8-009I6r-9x; Wed, 27 Sep 2023 10:10:46 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qlPd8-005BQ6-0m; Wed, 27 Sep 2023 10:10:46 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Benson Leung , Tzung-Bi Shih Cc: Guenter Roeck , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 01/27] platform/chrome: cros_ec_chardev: Convert to platform remove callback returning void Date: Wed, 27 Sep 2023 10:10:14 +0200 Message-Id: <20230927081040.2198742-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> References: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1833; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=Xe6M9G5oHpj29v0p0F+j+Zzzp8VU3j+XZbTFtKR2XC8=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlE+NeiBb7JrW4zkLm/SiYb1HpuFi88VxguMriX 3i2w3k/Yj6JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZRPjXgAKCRCPgPtYfRL+ TlPRB/9V/q+9Nu1bDmwLd4eMhIr7+4mEjxDJyZoypCumo78BRHLbXeRwy6q1aqMW/jZ9OLbUIQg aX5tkB3jkFdlCobZquUz+DBkjI375NRCmhSLCxxys2lhREZZnlfwdg3VOmFWM09apLwKa1t0XIe 06/g3lm7O6kJCiz72NP6qcPBtNfraWJ4OxIAAMKJLfsCfDQTzulmNEq0WneqTN/rl5fKiAJpIbx IV33lsVXIdtDxxRmmaFF0UpSpXbVmklUoYAmum5ZEHcDqKTIkOhCICFmtMHSiiKp/1DSQyFMUvz V1VvsWmO1bjFBo7IneI4dY5C9WfZA3FFhPjC7g18/zccoiv/ X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: chrome-platform@lists.linux.dev The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/platform/chrome/cros_ec_chardev.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_chardev.c b/drivers/platform/chrome/cros_ec_chardev.c index d6de5a294128..81950bb2c6da 100644 --- a/drivers/platform/chrome/cros_ec_chardev.c +++ b/drivers/platform/chrome/cros_ec_chardev.c @@ -396,13 +396,11 @@ static int cros_ec_chardev_probe(struct platform_device *pdev) return misc_register(&data->misc); } -static int cros_ec_chardev_remove(struct platform_device *pdev) +static void cros_ec_chardev_remove(struct platform_device *pdev) { struct chardev_data *data = dev_get_drvdata(&pdev->dev); misc_deregister(&data->misc); - - return 0; } static struct platform_driver cros_ec_chardev_driver = { @@ -410,7 +408,7 @@ static struct platform_driver cros_ec_chardev_driver = { .name = DRV_NAME, }, .probe = cros_ec_chardev_probe, - .remove = cros_ec_chardev_remove, + .remove_new = cros_ec_chardev_remove, }; module_platform_driver(cros_ec_chardev_driver); From patchwork Wed Sep 27 08:10:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13400319 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C89AB1D524 for ; Wed, 27 Sep 2023 08:10:55 +0000 (UTC) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qlPd8-0007vJ-Sw; Wed, 27 Sep 2023 10:10:46 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlPd8-009I6u-FO; Wed, 27 Sep 2023 10:10:46 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qlPd8-005BQ9-65; Wed, 27 Sep 2023 10:10:46 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Benson Leung , Tzung-Bi Shih Cc: Guenter Roeck , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 02/27] platform/chrome: cros_ec_debugfs: Convert to platform remove callback returning void Date: Wed, 27 Sep 2023 10:10:15 +0200 Message-Id: <20230927081040.2198742-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> References: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1906; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=RVm8Wdz9Q6CnBZemItiakkOT9n5aPdyjBNWm3I6HY+c=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlE+NfjPNWqXOBMQ5/PjYP/1aJLOB8pO9m/bGEH +7hRgy6jXuJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZRPjXwAKCRCPgPtYfRL+ TnSXB/4qcuZlqjIVUNIEnCj/w7OquDZWxrEQqF1SMDmuOB+0yDri/5C8xlZccSRZNNvzmBykGrS b83hSmuFoc6kFspKloGJuiBqcTlKhnu+abCJMDIQ040C9XyXO8Oo0w7pMNrj4w89Jx5w1gvaDIT BeFMikNOlGDTobFQf94yy+i8MbhJwREQJt4muLSwg8a4cN3L7jZ/sWY118pcW9nizwI170I1EsT 2fiYscI0cBHRqcb1YLUkrcllUK/1wFHTKk7HCRbo5LIFl9Tcqbr78Vi7bnHpYJU+7r/IsAJwUQu X0/iATJXFUXFLO8y7lEu3BF8iRSxnNBAAmjZhMzKDT0+bMg1 X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: chrome-platform@lists.linux.dev The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/platform/chrome/cros_ec_debugfs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c index c876120e0ebc..091fdc154d79 100644 --- a/drivers/platform/chrome/cros_ec_debugfs.c +++ b/drivers/platform/chrome/cros_ec_debugfs.c @@ -533,14 +533,12 @@ static int cros_ec_debugfs_probe(struct platform_device *pd) return ret; } -static int cros_ec_debugfs_remove(struct platform_device *pd) +static void cros_ec_debugfs_remove(struct platform_device *pd) { struct cros_ec_dev *ec = dev_get_drvdata(pd->dev.parent); debugfs_remove_recursive(ec->debug_info->dir); cros_ec_cleanup_console_log(ec->debug_info); - - return 0; } static int __maybe_unused cros_ec_debugfs_suspend(struct device *dev) @@ -573,7 +571,7 @@ static struct platform_driver cros_ec_debugfs_driver = { .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, .probe = cros_ec_debugfs_probe, - .remove = cros_ec_debugfs_remove, + .remove_new = cros_ec_debugfs_remove, }; module_platform_driver(cros_ec_debugfs_driver); From patchwork Wed Sep 27 08:10:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13400327 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D62F11D53F for ; Wed, 27 Sep 2023 08:10:55 +0000 (UTC) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qlPd9-0007vL-1t; Wed, 27 Sep 2023 10:10:47 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlPd8-009I6x-Ka; Wed, 27 Sep 2023 10:10:46 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qlPd8-005BQD-Ba; Wed, 27 Sep 2023 10:10:46 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Benson Leung , Tzung-Bi Shih Cc: Guenter Roeck , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 03/27] platform/chrome: cros_ec_lightbar: Convert to platform remove callback returning void Date: Wed, 27 Sep 2023 10:10:16 +0200 Message-Id: <20230927081040.2198742-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> References: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1998; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=Tfs5gi7h7v1Dwa3H1JCi2pH6aHZKCdFVdfdoZK+EHJA=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlE+NgCQKHZFj5mqOwyG6uYKFEWnnxsQRTVtbJ1 /YmRJcnkKyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZRPjYAAKCRCPgPtYfRL+ TgEwB/4iiOJeH8c8mxCUWtYw9NVWS834cnqPM7W8mzvLCpmz/PHR4fvj9Px95xRvwOn/gWJfVWY 0WJySnZFHYiQIZ8reBiJw3DqVIh4Ka7byTW7+8kaClQKd9HA/ZaDdD/xGpm37Xgg+GsH1Awaq/7 sAeVd3eLLzYDNQ9gisnGhwP/t4cM8/7l0Ar8Txf1OvpbmiPbXDvQFYtKAU74U5fC14uzxwwyRxX 5lr1Qn8xTvimqO6QJXGJlWB8xnkLCJJAbkug0UiVHXDGyd9axwUlgiwvNelul4yGeQY96ACVXQA 21HaoxUcIbf1ZkmsU0XZFgUvdAA+8P9/59MD48ZzjMkXoyMN X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: chrome-platform@lists.linux.dev The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/platform/chrome/cros_ec_lightbar.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c index 376425bbd8ff..6677cc6c4984 100644 --- a/drivers/platform/chrome/cros_ec_lightbar.c +++ b/drivers/platform/chrome/cros_ec_lightbar.c @@ -560,7 +560,7 @@ static int cros_ec_lightbar_probe(struct platform_device *pd) return ret; } -static int cros_ec_lightbar_remove(struct platform_device *pd) +static void cros_ec_lightbar_remove(struct platform_device *pd) { struct cros_ec_dev *ec_dev = dev_get_drvdata(pd->dev.parent); @@ -569,8 +569,6 @@ static int cros_ec_lightbar_remove(struct platform_device *pd) /* Let the EC take over the lightbar again. */ lb_manual_suspend_ctrl(ec_dev, 0); - - return 0; } static int __maybe_unused cros_ec_lightbar_resume(struct device *dev) @@ -603,7 +601,7 @@ static struct platform_driver cros_ec_lightbar_driver = { .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, .probe = cros_ec_lightbar_probe, - .remove = cros_ec_lightbar_remove, + .remove_new = cros_ec_lightbar_remove, }; module_platform_driver(cros_ec_lightbar_driver); From patchwork Wed Sep 27 08:10:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13400318 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6AB01D520 for ; Wed, 27 Sep 2023 08:10:55 +0000 (UTC) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qlPd9-0007vd-6k; Wed, 27 Sep 2023 10:10:47 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlPd8-009I70-Q2; Wed, 27 Sep 2023 10:10:46 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qlPd8-005BQH-Gr; Wed, 27 Sep 2023 10:10:46 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Benson Leung , Tzung-Bi Shih Cc: Guenter Roeck , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 04/27] platform/chrome: cros_ec_lpc: Convert to platform remove callback returning void Date: Wed, 27 Sep 2023 10:10:17 +0200 Message-Id: <20230927081040.2198742-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> References: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1943; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=UaQf0aOVJXiwdHwFWYo4P0yhmaqn5f73vpG9iCiRQPg=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlE+Nh8vWZtz/iFdllV5+D+P+cfjaMU6C4DQ7d0 /+1D3PLh0SJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZRPjYQAKCRCPgPtYfRL+ Tp3FB/9lOQ/A452SjdzNZdgRv/RkGyVoKEua5t6iB3pV5YLNbs3o2QgaowqnxYbDooMVrzKIIOC ENs6k+iT0W+SnomZwuyUsry1H63YYawHFMk3OIgS/yJZRdyA3xaoOlqauVsYCqFYTFPgbqvH+Nw JY8zcKh6+bA6qQVBOWOyzXdSUf9+CCaWZn/xWS4XgseRDpKY5ZC7rdO2/CHUWip619zYnjGxbEL qwUuEAKtcQtvim/fRwpkazLjcI3WvTN2UgboVMcdMELLI2BTY5UiEPGRTf6xjDe04OvB91G+JF6 hDbptCQ6gTQTafv427EjajEyQZzOLqw5PCmZ95Cv9zODuDdi X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: chrome-platform@lists.linux.dev The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/platform/chrome/cros_ec_lpc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c index 356572452898..897090f0f26e 100644 --- a/drivers/platform/chrome/cros_ec_lpc.c +++ b/drivers/platform/chrome/cros_ec_lpc.c @@ -460,7 +460,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev) return 0; } -static int cros_ec_lpc_remove(struct platform_device *pdev) +static void cros_ec_lpc_remove(struct platform_device *pdev) { struct cros_ec_device *ec_dev = platform_get_drvdata(pdev); struct acpi_device *adev; @@ -471,8 +471,6 @@ static int cros_ec_lpc_remove(struct platform_device *pdev) cros_ec_lpc_acpi_notify); cros_ec_unregister(ec_dev); - - return 0; } static const struct acpi_device_id cros_ec_lpc_acpi_device_ids[] = { @@ -580,7 +578,7 @@ static struct platform_driver cros_ec_lpc_driver = { .probe_type = PROBE_FORCE_SYNCHRONOUS, }, .probe = cros_ec_lpc_probe, - .remove = cros_ec_lpc_remove, + .remove_new = cros_ec_lpc_remove, }; static struct platform_device cros_ec_lpc_device = { From patchwork Wed Sep 27 08:10:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13400322 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7652B1D54B for ; Wed, 27 Sep 2023 08:10:56 +0000 (UTC) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qlPd9-0007vn-C3; Wed, 27 Sep 2023 10:10:47 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlPd8-009I74-VK; Wed, 27 Sep 2023 10:10:46 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qlPd8-005BQL-ME; Wed, 27 Sep 2023 10:10:46 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Benson Leung , Tzung-Bi Shih Cc: Guenter Roeck , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 05/27] platform/chrome: cros_ec_sysfs: Convert to platform remove callback returning void Date: Wed, 27 Sep 2023 10:10:18 +0200 Message-Id: <20230927081040.2198742-6-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> References: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1817; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=3lSPxCFD1tq2Ndhu8Jm0oL7exa9/6adrI2DF9CzQxXU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlE+NjqLUjcpZ/13xJOpHxVYPPQ90yw5MvqynGX Z7ANlesk5mJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZRPjYwAKCRCPgPtYfRL+ TvANB/wN94PSnE599Yi2EgxmuAfZ8Xt73/1wNxy0lVQ9MmStcdFSGyHLEX5clucwN0JZmgUyTCi +kTEfx8aga1vcRzMQzg5oj/5rIkyJQkKoCLzCyRVkXuerH1H6jAJGG3PYw1xSkuupahpUjxiAQm fkwvtCnsL4ECsZsnTCV6L1rOrqmY38vGcmwS2cMGJV5ijn1i6/WAmb0fpLd5uiy/JxLN1L4TpUs 08QwyB6JbNN0zg525GrajEFTFbjbKNqyMAx+b2t//GraRUc2Bp9z0qXQ6zF0d8WdRLsihGlzfsl EjYVVS/2oGW6WXR1QDIUVp+Y2Ed5Bn4tdgfBNQz/BSO7WmUe X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: chrome-platform@lists.linux.dev The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/platform/chrome/cros_ec_sysfs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_sysfs.c b/drivers/platform/chrome/cros_ec_sysfs.c index 09e3bf5e8ec6..93e67ab4af06 100644 --- a/drivers/platform/chrome/cros_ec_sysfs.c +++ b/drivers/platform/chrome/cros_ec_sysfs.c @@ -340,13 +340,11 @@ static int cros_ec_sysfs_probe(struct platform_device *pd) return ret; } -static int cros_ec_sysfs_remove(struct platform_device *pd) +static void cros_ec_sysfs_remove(struct platform_device *pd) { struct cros_ec_dev *ec_dev = dev_get_drvdata(pd->dev.parent); sysfs_remove_group(&ec_dev->class_dev.kobj, &cros_ec_attr_group); - - return 0; } static struct platform_driver cros_ec_sysfs_driver = { @@ -354,7 +352,7 @@ static struct platform_driver cros_ec_sysfs_driver = { .name = DRV_NAME, }, .probe = cros_ec_sysfs_probe, - .remove = cros_ec_sysfs_remove, + .remove_new = cros_ec_sysfs_remove, }; module_platform_driver(cros_ec_sysfs_driver); From patchwork Wed Sep 27 08:10:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13400325 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C2D91D557 for ; Wed, 27 Sep 2023 08:10:56 +0000 (UTC) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qlPd9-0007vx-Hi; Wed, 27 Sep 2023 10:10:47 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlPd9-009I78-4c; Wed, 27 Sep 2023 10:10:47 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qlPd8-005BQP-Rv; Wed, 27 Sep 2023 10:10:46 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Benson Leung , Tzung-Bi Shih Cc: Guenter Roeck , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 06/27] platform/chrome: cros_ec_vbc: Convert to platform remove callback returning void Date: Wed, 27 Sep 2023 10:10:19 +0200 Message-Id: <20230927081040.2198742-7-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> References: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1801; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=pRAFLcjtBRkjAHFm0hdN5Z1Edd3V/IN+r+RHfA3N/cI=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlE+NknKE5ENkvfTD1DnSisbqpVw7SmCWcyCB/y o/2TihxkEqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZRPjZAAKCRCPgPtYfRL+ TphwB/90LVptfTjJ6jikR/SzCxT9BZNEfHxziPKECJUhxG8bsif93ilg1HxOl+2mCRXa44k7z/J M84fKFNYRo8WFJs7J2HOQWAMiDtxcOsVNo/ts6rSI4qbuHJJsFITqtnHsZyWxViKWNiBtj4P9M9 HUanRLmZ2V+A3UfSypt3uk4/Opel6bK20O6U3KGaB1x22/HWnPk93y7RKPAwuFqpirhMmsWGD0R +Rfd97eGQQKVwRpkGJyT2cZiZbq7ACAGUv9JYCgVIsHpLDbKZx43Ddi/X349LJZZJeSkUvF5pHn BC6QZl3O1zz0JnsKRweYCxF4pMG3fM27dc+Jxe9KtJBZWZYy X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: chrome-platform@lists.linux.dev The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/platform/chrome/cros_ec_vbc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_vbc.c b/drivers/platform/chrome/cros_ec_vbc.c index c859c862d7ac..2e4af10c7679 100644 --- a/drivers/platform/chrome/cros_ec_vbc.c +++ b/drivers/platform/chrome/cros_ec_vbc.c @@ -121,14 +121,12 @@ static int cros_ec_vbc_probe(struct platform_device *pd) return ret; } -static int cros_ec_vbc_remove(struct platform_device *pd) +static void cros_ec_vbc_remove(struct platform_device *pd) { struct cros_ec_dev *ec_dev = dev_get_drvdata(pd->dev.parent); sysfs_remove_group(&ec_dev->class_dev.kobj, &cros_ec_vbc_attr_group); - - return 0; } static struct platform_driver cros_ec_vbc_driver = { @@ -136,7 +134,7 @@ static struct platform_driver cros_ec_vbc_driver = { .name = DRV_NAME, }, .probe = cros_ec_vbc_probe, - .remove = cros_ec_vbc_remove, + .remove_new = cros_ec_vbc_remove, }; module_platform_driver(cros_ec_vbc_driver); From patchwork Wed Sep 27 08:10:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13400321 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFD621D52F for ; Wed, 27 Sep 2023 08:10:55 +0000 (UTC) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qlPd9-0007w7-Nv; Wed, 27 Sep 2023 10:10:47 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlPd9-009I7D-Ah; Wed, 27 Sep 2023 10:10:47 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qlPd9-005BQT-1m; Wed, 27 Sep 2023 10:10:47 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Prashant Malani , Benson Leung , Tzung-Bi Shih Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 07/27] platform/chrome: cros_typec_switch: Convert to platform remove callback returning void Date: Wed, 27 Sep 2023 10:10:20 +0200 Message-Id: <20230927081040.2198742-8-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> References: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1884; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=apwdajEkBtcz1JyrpEsZ4Sy0crzZ/8cLvtcXTlSY44Q=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlE+NlOZvTbEbzfEvNTwTHvGtIkJoSZGWTHt9rb yc/d3LGIRKJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZRPjZQAKCRCPgPtYfRL+ TlUXB/4l0vgezcHrQ+T7WnUcbW5ahMqeimC7Cp1K+nnAcKjZnaC7Z0kznQrT4O5kdE9fdPJIblD FovOU+zgMs/AMd4bv9tFYBwwgVK8TWFsBSILh/h2hU1YJ0DBtRtYvWv3IjQPvTjSj9PLpVbUHZx /98pDno9jyifGThEAoB16/yLQMDK5JDN6qlCSTtLuTDmZf09dbsBpTd6O4K+P5oucwJOcithevI m7x2Wi8fY8Eqw8w3rlbvPiY7vfJz1b0rfcr3hat1yTn4BNhluGTMq1fuXdH2lfmYe49mKMXdCIA YjBnlei/N6jb6saikr4H+Sorw24Kp40LRS429Q54rpypTedD X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: chrome-platform@lists.linux.dev The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Acked-by: Prashant Malani --- drivers/platform/chrome/cros_typec_switch.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index 0eefdcf14d63..07a19386dc4e 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -297,12 +297,11 @@ static int cros_typec_switch_probe(struct platform_device *pdev) return cros_typec_register_switches(sdata); } -static int cros_typec_switch_remove(struct platform_device *pdev) +static void cros_typec_switch_remove(struct platform_device *pdev) { struct cros_typec_switch_data *sdata = platform_get_drvdata(pdev); cros_typec_unregister_switches(sdata); - return 0; } #ifdef CONFIG_ACPI @@ -319,7 +318,7 @@ static struct platform_driver cros_typec_switch_driver = { .acpi_match_table = ACPI_PTR(cros_typec_switch_acpi_id), }, .probe = cros_typec_switch_probe, - .remove = cros_typec_switch_remove, + .remove_new = cros_typec_switch_remove, }; module_platform_driver(cros_typec_switch_driver); From patchwork Wed Sep 27 08:10:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13400320 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7853A1D550 for ; Wed, 27 Sep 2023 08:10:56 +0000 (UTC) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qlPd9-0007wR-W6; Wed, 27 Sep 2023 10:10:48 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlPd9-009I7H-HW; Wed, 27 Sep 2023 10:10:47 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qlPd9-005BQY-8S; Wed, 27 Sep 2023 10:10:47 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Benson Leung , Tzung-Bi Shih Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 08/27] platform/chrome: cros_usbpd_logger: Convert to platform remove callback returning void Date: Wed, 27 Sep 2023 10:10:21 +0200 Message-Id: <20230927081040.2198742-9-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> References: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1915; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=OR3i3JXD2RroVrhEaYXFvH7Zyx63QW9KL3sGpWCOSHI=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlE+NmcnjMJd1YF7F9Gmo1cKEwJETNMDNXQ8MpI +/rkZ4CkG2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZRPjZgAKCRCPgPtYfRL+ TsedCACLo1awQfxrjnzfeCY8rAFtLXItTZBOhX68W7MhGBIue8KMiomkwzPEc4QO2EGPuHyBJgc LEP/AZ56sPA9AGaWsxnQcswD0DN2d0rKTQZrMONwkPrnf2ba5avG+mhOLWbVs3FN4aAbx9gj8Sj M7ZbJnExojsGA6df6k1o5sZtaYh1vaOftfre8XIn7A1c2Tw0fv4BzUsrYYpA6Su2qhGNtvZrTi+ zEQ+8DaALtH/U6mOIGuLgjEBNwBVdzanKp9WBp+yamwv2JRQxcg7ZnwYEfIlCHT2TYtg69YwJfE rgkWghOhE7zWiSQg1zZPqW4RspRoLL2GDNfOtf9gFNq5Wciu X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: chrome-platform@lists.linux.dev The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/platform/chrome/cros_usbpd_logger.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/cros_usbpd_logger.c b/drivers/platform/chrome/cros_usbpd_logger.c index d16931203d82..f618757f8b32 100644 --- a/drivers/platform/chrome/cros_usbpd_logger.c +++ b/drivers/platform/chrome/cros_usbpd_logger.c @@ -219,14 +219,12 @@ static int cros_usbpd_logger_probe(struct platform_device *pd) return 0; } -static int cros_usbpd_logger_remove(struct platform_device *pd) +static void cros_usbpd_logger_remove(struct platform_device *pd) { struct logger_data *logger = platform_get_drvdata(pd); cancel_delayed_work_sync(&logger->log_work); destroy_workqueue(logger->log_workqueue); - - return 0; } static int __maybe_unused cros_usbpd_logger_resume(struct device *dev) @@ -257,7 +255,7 @@ static struct platform_driver cros_usbpd_logger_driver = { .pm = &cros_usbpd_logger_pm_ops, }, .probe = cros_usbpd_logger_probe, - .remove = cros_usbpd_logger_remove, + .remove_new = cros_usbpd_logger_remove, }; module_platform_driver(cros_usbpd_logger_driver); From patchwork Wed Sep 27 08:10:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13400323 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E84F1D55B for ; Wed, 27 Sep 2023 08:10:56 +0000 (UTC) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qlPdA-0007xR-6v; Wed, 27 Sep 2023 10:10:48 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlPd9-009I7L-NV; Wed, 27 Sep 2023 10:10:47 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qlPd9-005BQc-EN; Wed, 27 Sep 2023 10:10:47 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Prashant Malani , Benson Leung , Tzung-Bi Shih Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 09/27] platform/chrome: cros_usbpd_notify: Convert to platform remove callback returning void Date: Wed, 27 Sep 2023 10:10:22 +0200 Message-Id: <20230927081040.2198742-10-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> References: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2938; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=hSEWunQsqDf9o0Gu7AfSQmYYAjV96zrpal7gSYkj2l4=; b=owGbwMvMwMXY3/A7olbonx/jabUkhlThx+mvgrMFV7z2kFm3lCWlqUUko8Tb9XNgf4xJXc53x 8o9hs86GY1ZGBi5GGTFFFnsG9dkWlXJRXau/XcZZhArE8gUBi5OAZgIXwoHww5lvfVq5s91rYw2 x50wyvB+cPb/0kUpLMvKcktr906p1+eKS/v37OqaWPWtN49Py+T57ZnAXm2zMOPi9zjJA4IiprL n5709uyBX45XgdLMtTtN2zcs4HL/MxcuxS+rShh0X/907rP/nY/f1YFa+Xu/fM7nqjAWrjUVs9n gWKD81/s80W+705U7RnY0ParolE8v/frYvrjnOvGCapJbmgU3Mp5rWp07ac3OeW4m7+/rsbYs2R 0i/OhGdpv+gz2NFV2af4mYTHXb+yBKbqdsL1c8HyGmo6Xas81hluPRByUouaW3zhe0O+zy3PeVv dv68KE9w1c8VaXeDJ8Snayxu6+05bmC1SlBGYI4Iz5qJAA== X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: chrome-platform@lists.linux.dev The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Acked-by: Prashant Malani --- drivers/platform/chrome/cros_usbpd_notify.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/platform/chrome/cros_usbpd_notify.c b/drivers/platform/chrome/cros_usbpd_notify.c index 10670b6588e3..aacad022f21d 100644 --- a/drivers/platform/chrome/cros_usbpd_notify.c +++ b/drivers/platform/chrome/cros_usbpd_notify.c @@ -134,15 +134,13 @@ static int cros_usbpd_notify_probe_acpi(struct platform_device *pdev) return 0; } -static int cros_usbpd_notify_remove_acpi(struct platform_device *pdev) +static void cros_usbpd_notify_remove_acpi(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct acpi_device *adev = ACPI_COMPANION(dev); acpi_remove_notify_handler(adev->handle, ACPI_ALL_NOTIFY, cros_usbpd_notify_acpi); - - return 0; } static const struct acpi_device_id cros_usbpd_notify_acpi_device_ids[] = { @@ -157,7 +155,7 @@ static struct platform_driver cros_usbpd_notify_acpi_driver = { .acpi_match_table = cros_usbpd_notify_acpi_device_ids, }, .probe = cros_usbpd_notify_probe_acpi, - .remove = cros_usbpd_notify_remove_acpi, + .remove_new = cros_usbpd_notify_remove_acpi, }; #endif /* CONFIG_ACPI */ @@ -209,7 +207,7 @@ static int cros_usbpd_notify_probe_plat(struct platform_device *pdev) return 0; } -static int cros_usbpd_notify_remove_plat(struct platform_device *pdev) +static void cros_usbpd_notify_remove_plat(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct cros_ec_dev *ecdev = dev_get_drvdata(dev->parent); @@ -218,8 +216,6 @@ static int cros_usbpd_notify_remove_plat(struct platform_device *pdev) blocking_notifier_chain_unregister(&ecdev->ec_dev->event_notifier, &pdnotify->nb); - - return 0; } static struct platform_driver cros_usbpd_notify_plat_driver = { @@ -227,7 +223,7 @@ static struct platform_driver cros_usbpd_notify_plat_driver = { .name = DRV_NAME, }, .probe = cros_usbpd_notify_probe_plat, - .remove = cros_usbpd_notify_remove_plat, + .remove_new = cros_usbpd_notify_remove_plat, }; static int __init cros_usbpd_notify_init(void) From patchwork Wed Sep 27 08:10:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13400326 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6758C1D520 for ; Wed, 27 Sep 2023 08:10:58 +0000 (UTC) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qlPdA-00080D-RB; Wed, 27 Sep 2023 10:10:48 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlPd9-009I7P-Vi; Wed, 27 Sep 2023 10:10:47 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qlPd9-005BQg-MV; Wed, 27 Sep 2023 10:10:47 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Benson Leung , Tzung-Bi Shih , Guenter Roeck , Brian Norris Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 10/27] platform/chrome/wilco_ec: core: Convert to platform remove callback returning void Date: Wed, 27 Sep 2023 10:10:23 +0200 Message-Id: <20230927081040.2198742-11-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> References: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1940; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=ErTBgUVBzAoUk5cH94Ob31zJEYM2LgwwmCXualZPhgg=; b=owGbwMvMwMXY3/A7olbonx/jabUkhlThxxmfEz5LascytexPrvRqs/8+7eD1S0ZyPJxbCj67h 3vmHnHsZDRmYWDkYpAVU2Sxb1yTaVUlF9m59t9lmEGsTCBTGLg4BWAiT4LY/8orBVcvZNkt+buI 93Dtqxz1Wh71Ah11/Z9M0ZmsrL4Pnn48tFCqS83TIjt0gmfo8p97GPWfPjzfZ+0fXBN3upwvzKH kqdH2ZUf/Lo2bZ/fw3IVnW7pUl22v0qlfd7+/X1qtN32vUk9n89V/wbGNaZFzZ00sSbobzfik5L Kl4K5pNz8X9buIPKrZprPfr+2zY4q+q4zZvNXO79vT5DotNa43HZryeun7GskPNSkpz1h2rBc3X Lv5M1P8BVNRfcbChXzvHuSWLZdjfis9L8MjsevK9cK/OQ6nZvRvfXuT1zv1LvMS5+Ssjo898Z2K pkf1uuNzAuateDCT76LknyvRdULhDiv3q195sDat/WkCAA== X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: chrome-platform@lists.linux.dev The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/platform/chrome/wilco_ec/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/platform/chrome/wilco_ec/core.c b/drivers/platform/chrome/wilco_ec/core.c index d6a994bdc182..9b59a1bed286 100644 --- a/drivers/platform/chrome/wilco_ec/core.c +++ b/drivers/platform/chrome/wilco_ec/core.c @@ -132,7 +132,7 @@ static int wilco_ec_probe(struct platform_device *pdev) return ret; } -static int wilco_ec_remove(struct platform_device *pdev) +static void wilco_ec_remove(struct platform_device *pdev) { struct wilco_ec_device *ec = platform_get_drvdata(pdev); @@ -142,7 +142,6 @@ static int wilco_ec_remove(struct platform_device *pdev) platform_device_unregister(ec->rtc_pdev); if (ec->debugfs_pdev) platform_device_unregister(ec->debugfs_pdev); - return 0; } static const struct acpi_device_id wilco_ec_acpi_device_ids[] = { @@ -157,7 +156,7 @@ static struct platform_driver wilco_ec_driver = { .acpi_match_table = wilco_ec_acpi_device_ids, }, .probe = wilco_ec_probe, - .remove = wilco_ec_remove, + .remove_new = wilco_ec_remove, }; module_platform_driver(wilco_ec_driver); From patchwork Wed Sep 27 08:10:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13400328 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E99B11D520 for ; Wed, 27 Sep 2023 08:11:00 +0000 (UTC) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qlPdB-00081z-8y; Wed, 27 Sep 2023 10:10:49 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlPdA-009I7T-6z; Wed, 27 Sep 2023 10:10:48 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qlPd9-005BQk-Tu; Wed, 27 Sep 2023 10:10:47 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Benson Leung , Tzung-Bi Shih , Zhengkang Huang , Dongliang Mu Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 11/27] platform/chrome/wilco_ec: debugfs: Convert to platform remove callback returning void Date: Wed, 27 Sep 2023 10:10:24 +0200 Message-Id: <20230927081040.2198742-12-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> References: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1771; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=bdoY/EtxbzwGac07X7QaXwCA5t1k2AQDGRrpm1QXcFY=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlE+NqvJA6HQaG3wjrRzTg5qUXDxciOD4p/u8Io H+ZbLvmskiJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZRPjagAKCRCPgPtYfRL+ Ti+cB/oDTY0N5rzLT7v1Lf+32NNSBMke3xMTEuFylY+/55IpS3H8pe0o6vOI7lxiG1ZAQFHzcdq xgG+BVpp+Knl/ZtIoU5KeOpLhVIxrHBN0Ct+2h6jKH0ibrwaAsJm9t5ps/8XaRF9kYr5UdtkDrv F0E2JTIfg28prv/MpX/AR5b3ceFq8tVw79lWPCP1fwMeJYX2DGJvdj+i7BvX2pZA7zCuLjnH2x8 WYaUlZPkPxZ5xqwf50GXR2e0RdfZszlF+GjUkU/gK1YQH7yOGSKG30uyPsdIQKSkSaZn6TKVSIm 53KsZkhiRVIlIO3FS14kTK/s0Z0f89vQucQdWt9DdxB9cJTi X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: chrome-platform@lists.linux.dev The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/platform/chrome/wilco_ec/debugfs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/wilco_ec/debugfs.c b/drivers/platform/chrome/wilco_ec/debugfs.c index 7a13f13b16cd..93c11f81ca45 100644 --- a/drivers/platform/chrome/wilco_ec/debugfs.c +++ b/drivers/platform/chrome/wilco_ec/debugfs.c @@ -260,11 +260,9 @@ static int wilco_ec_debugfs_probe(struct platform_device *pdev) return 0; } -static int wilco_ec_debugfs_remove(struct platform_device *pdev) +static void wilco_ec_debugfs_remove(struct platform_device *pdev) { debugfs_remove_recursive(debug_info->dir); - - return 0; } static struct platform_driver wilco_ec_debugfs_driver = { @@ -272,7 +270,7 @@ static struct platform_driver wilco_ec_debugfs_driver = { .name = DRV_NAME, }, .probe = wilco_ec_debugfs_probe, - .remove = wilco_ec_debugfs_remove, + .remove_new = wilco_ec_debugfs_remove, }; module_platform_driver(wilco_ec_debugfs_driver); From patchwork Wed Sep 27 08:10:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13400324 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 676B21D693 for ; Wed, 27 Sep 2023 08:10:58 +0000 (UTC) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qlPdB-00082w-94; Wed, 27 Sep 2023 10:10:49 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlPdA-009I7X-Cv; Wed, 27 Sep 2023 10:10:48 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qlPdA-005BQo-3z; Wed, 27 Sep 2023 10:10:48 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Benson Leung , Tzung-Bi Shih , Greg Kroah-Hartman Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 12/27] platform/chrome/wilco_ec: telemetry: Convert to platform remove callback returning void Date: Wed, 27 Sep 2023 10:10:25 +0200 Message-Id: <20230927081040.2198742-13-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> References: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1794; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=49ld1JhVzgaDQZfMoKqFWG6KmV/4hCWeK0rFORIEYVg=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlE+Nr8n7BQCGsykVZITS7s6/ahZU543slwD9v0 /FLaGic9FSJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZRPjawAKCRCPgPtYfRL+ TpZhB/4t7XGbohjP5wIzeFerTgLgJlW5MNt4VJYnj06gyfUWS4TSaP4k1wHzsVzKuAlD+8S770q +szZwk/iajBIUKZQrvw2kwA+xFZ+J+nF7FUDnbtjA1RQwY533GOe7pBriSGpL+IeINvpTh+RAHW fJpZaXLnEonUENT34a5g5jfKr3JwaCmgW+UNcNwxbQ+8SIZa0PgxUxoEe7/9wmA13kzf/4M7kXv 1ImWQwJgRC1kl7AfZP6SQqt2PbZwQrDNSEhw98E8q13MqZDZhGGXjnCnEXaxnToHUYkstyyDJkP /kxMrmy3+FTi3bveCg1RjTFr3nmmozjwhxo2d8r/dnXpO1Bv X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: chrome-platform@lists.linux.dev The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/platform/chrome/wilco_ec/telemetry.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/wilco_ec/telemetry.c b/drivers/platform/chrome/wilco_ec/telemetry.c index 54708aa6c700..253098bace63 100644 --- a/drivers/platform/chrome/wilco_ec/telemetry.c +++ b/drivers/platform/chrome/wilco_ec/telemetry.c @@ -400,20 +400,18 @@ static int telem_device_probe(struct platform_device *pdev) return 0; } -static int telem_device_remove(struct platform_device *pdev) +static void telem_device_remove(struct platform_device *pdev) { struct telem_device_data *dev_data = platform_get_drvdata(pdev); cdev_device_del(&dev_data->cdev, &dev_data->dev); ida_simple_remove(&telem_ida, MINOR(dev_data->dev.devt)); put_device(&dev_data->dev); - - return 0; } static struct platform_driver telem_driver = { .probe = telem_device_probe, - .remove = telem_device_remove, + .remove_new = telem_device_remove, .driver = { .name = DRV_NAME, },