All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yangtao Li <frank.li@vivo.com>
To: Guillaume La Roque <glaroque@baylibre.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>
Cc: "Yangtao Li" <frank.li@vivo.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	linux-pm@vger.kernel.org, linux-amlogic@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 01/27] thermal/drivers/amlogic: Convert to platform remove callback returning void
Date: Wed, 12 Jul 2023 16:12:32 +0800	[thread overview]
Message-ID: <20230712081258.29254-1-frank.li@vivo.com> (raw)

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 (mostly) ignored
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.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/thermal/amlogic_thermal.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c
index 756b218880a7..a95c8959e5af 100644
--- a/drivers/thermal/amlogic_thermal.c
+++ b/drivers/thermal/amlogic_thermal.c
@@ -293,11 +293,11 @@ static int amlogic_thermal_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int amlogic_thermal_remove(struct platform_device *pdev)
+static void amlogic_thermal_remove(struct platform_device *pdev)
 {
 	struct amlogic_thermal *data = platform_get_drvdata(pdev);
 
-	return amlogic_thermal_disable(data);
+	amlogic_thermal_disable(data);
 }
 
 static int __maybe_unused amlogic_thermal_suspend(struct device *dev)
@@ -324,7 +324,7 @@ static struct platform_driver amlogic_thermal_driver = {
 		.of_match_table = of_amlogic_thermal_match,
 	},
 	.probe	= amlogic_thermal_probe,
-	.remove	= amlogic_thermal_remove,
+	.remove_new = amlogic_thermal_remove,
 };
 
 module_platform_driver(amlogic_thermal_driver);
-- 
2.39.0


WARNING: multiple messages have this Message-ID (diff)
From: Yangtao Li <frank.li@vivo.com>
To: Guillaume La Roque <glaroque@baylibre.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>
Cc: "Yangtao Li" <frank.li@vivo.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	linux-pm@vger.kernel.org, linux-amlogic@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 01/27] thermal/drivers/amlogic: Convert to platform remove callback returning void
Date: Wed, 12 Jul 2023 16:12:32 +0800	[thread overview]
Message-ID: <20230712081258.29254-1-frank.li@vivo.com> (raw)

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 (mostly) ignored
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.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/thermal/amlogic_thermal.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c
index 756b218880a7..a95c8959e5af 100644
--- a/drivers/thermal/amlogic_thermal.c
+++ b/drivers/thermal/amlogic_thermal.c
@@ -293,11 +293,11 @@ static int amlogic_thermal_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int amlogic_thermal_remove(struct platform_device *pdev)
+static void amlogic_thermal_remove(struct platform_device *pdev)
 {
 	struct amlogic_thermal *data = platform_get_drvdata(pdev);
 
-	return amlogic_thermal_disable(data);
+	amlogic_thermal_disable(data);
 }
 
 static int __maybe_unused amlogic_thermal_suspend(struct device *dev)
@@ -324,7 +324,7 @@ static struct platform_driver amlogic_thermal_driver = {
 		.of_match_table = of_amlogic_thermal_match,
 	},
 	.probe	= amlogic_thermal_probe,
-	.remove	= amlogic_thermal_remove,
+	.remove_new = amlogic_thermal_remove,
 };
 
 module_platform_driver(amlogic_thermal_driver);
-- 
2.39.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

             reply	other threads:[~2023-07-12  8:14 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12  8:12 Yangtao Li [this message]
2023-07-12  8:12 ` [PATCH 01/27] thermal/drivers/amlogic: Convert to platform remove callback returning void Yangtao Li
2023-07-12  8:12 ` [PATCH 02/27] thermal/drivers/armada: " Yangtao Li
2023-07-12  8:46   ` Miquel Raynal
2023-07-12 12:44   ` Uwe Kleine-König
2023-07-12  8:12 ` [PATCH 03/27] thermal/drivers/broadcom: " Yangtao Li
2023-07-12  8:12   ` Yangtao Li
2023-07-12 10:06   ` Uwe Kleine-König
2023-07-12 10:06     ` Uwe Kleine-König
2023-07-12 15:38   ` Florian Fainelli
2023-07-12 15:38     ` Florian Fainelli
2023-07-12  8:12 ` [PATCH 04/27] drivers/thermal/rcar_gen3_thermal: " Yangtao Li
2023-07-12 10:07   ` Uwe Kleine-König
2023-07-12 11:44   ` Geert Uytterhoeven
2023-07-12 13:22   ` Niklas Söderlund
2023-07-12  8:12 ` [PATCH 05/27] thermal/drivers/imx8mm_thermal: " Yangtao Li
2023-07-12  8:12   ` Yangtao Li
2023-07-12  8:12 ` [PATCH 06/27] thermal/drivers/mediatek/lvts_thermal: " Yangtao Li
2023-07-12  8:12   ` Yangtao Li
2023-07-12 10:14   ` Uwe Kleine-König
2023-07-12 10:14     ` Uwe Kleine-König
2023-07-12  8:12 ` [PATCH 07/27] thermal/drivers/qcom: " Yangtao Li
2023-07-12  8:12 ` [PATCH 08/27] thermal/drivers/hisi: " Yangtao Li
2023-07-12  8:12 ` [PATCH 09/27] thermal/drivers/spear: " Yangtao Li
2023-07-12  8:12 ` [PATCH 10/27] thermal/drivers/rockchip: " Yangtao Li
2023-07-12  8:12   ` Yangtao Li
2023-07-12  8:12   ` Yangtao Li
2023-07-12  8:12 ` [PATCH 11/27] thermal/drivers/uniphier: " Yangtao Li
2023-07-12  8:12   ` Yangtao Li
2023-07-12  8:12 ` [PATCH 12/27] thermal/drivers/dove: " Yangtao Li
2023-07-12  8:12 ` [PATCH 13/27] thermal/drivers/k3_j72xx_bandgap: " Yangtao Li
2023-07-12  8:12 ` [PATCH 14/27] thermal/drivers/tegra-bpmp: " Yangtao Li
2023-07-12  8:12 ` [PATCH 15/27] thermal/drivers/imx: " Yangtao Li
2023-07-12  8:12   ` Yangtao Li
2023-07-12  8:12 ` [PATCH 16/27] thermal/drivers/da9062: " Yangtao Li
2023-07-12  8:12 ` [PATCH 17/27] thermal/drivers/broadcom: " Yangtao Li
2023-07-12  8:12 ` [PATCH 18/27] thermal/drivers/rzg2l: " Yangtao Li
2023-07-12  8:12 ` [PATCH 19/27] drivers/thermal/k3: " Yangtao Li
2023-07-12  8:12 ` [PATCH 20/27] thermal/drivers/sprd: " Yangtao Li
2023-07-12  8:12 ` [PATCH 21/27] thermal/drivers/rcar_thermal: " Yangtao Li
2023-07-12 11:43   ` Geert Uytterhoeven
2023-07-12 12:49   ` Uwe Kleine-König
2023-07-12 13:23   ` Niklas Söderlund
2023-07-12  8:12 ` [PATCH 22/27] thermal/ti-soc-thermal: " Yangtao Li
2023-07-12  8:12 ` [PATCH 23/27] thermal/drivers/stm: " Yangtao Li
2023-07-12  8:12   ` Yangtao Li
2023-07-12  8:12 ` [PATCH 24/27] thermal/drivers/tegra-soctherm: " Yangtao Li
2023-07-12  8:12 ` [PATCH 25/27] thermal/drivers/exynos: " Yangtao Li
2023-07-12  8:12   ` Yangtao Li
2023-07-12  8:12 ` [PATCH 26/27] thermal/drivers/kirkwood: " Yangtao Li
2023-07-12  8:12 ` [PATCH 27/27] thermal: intel: int340x: " Yangtao Li
2023-07-14 19:01   ` Rafael J. Wysocki
2023-07-12 10:05 ` [PATCH 01/27] thermal/drivers/amlogic: " Uwe Kleine-König
2023-07-12 10:05   ` Uwe Kleine-König

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=20230712081258.29254-1-frank.li@vivo.com \
    --to=frank.li@vivo.com \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=glaroque@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.