b3bfa37458c8b9f1458a5e9dd91e01048c9e6ee2
[openwrt/staging/mans0n.git] /
1 From 6cf96078969ec00b873db99bae4e47001290685e Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
3 Date: Wed, 27 Sep 2023 21:37:23 +0200
4 Subject: [PATCH 35/42] thermal: lvts: Convert to platform remove callback
5 returning void
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 The .remove() callback for a platform driver returns an int which makes
11 many driver authors wrongly assume it's possible to do error handling by
12 returning an error code. However the value returned is ignored (apart
13 from emitting a warning) and this typically results in resource leaks.
14
15 To improve here there is a quest to make the remove callback return
16 void. In the first step of this quest all drivers are converted to
17 .remove_new(), which already returns void. Eventually after all drivers
18 are converted, .remove_new() will be renamed to .remove().
19
20 Trivially convert this driver from always returning zero in the remove
21 callback to the void returning variant.
22
23 Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
24 Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
25 Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
26 ---
27 drivers/thermal/mediatek/lvts_thermal.c | 6 ++----
28 1 file changed, 2 insertions(+), 4 deletions(-)
29
30 --- a/drivers/thermal/mediatek/lvts_thermal.c
31 +++ b/drivers/thermal/mediatek/lvts_thermal.c
32 @@ -1241,7 +1241,7 @@ static int lvts_probe(struct platform_de
33 return 0;
34 }
35
36 -static int lvts_remove(struct platform_device *pdev)
37 +static void lvts_remove(struct platform_device *pdev)
38 {
39 struct lvts_domain *lvts_td;
40 int i;
41 @@ -1252,8 +1252,6 @@ static int lvts_remove(struct platform_d
42 lvts_ctrl_set_enable(&lvts_td->lvts_ctrl[i], false);
43
44 lvts_debugfs_exit(lvts_td);
45 -
46 - return 0;
47 }
48
49 static const struct lvts_ctrl_data mt8195_lvts_mcu_data_ctrl[] = {
50 @@ -1354,7 +1352,7 @@ MODULE_DEVICE_TABLE(of, lvts_of_match);
51
52 static struct platform_driver lvts_driver = {
53 .probe = lvts_probe,
54 - .remove = lvts_remove,
55 + .remove_new = lvts_remove,
56 .driver = {
57 .name = "mtk-lvts-thermal",
58 .of_match_table = lvts_of_match,