27d9270d31ee396f7cab7f738f85664966b67295
[openwrt/staging/wigyori.git] /
1 From 693d2f629962628ddefc88f4b6b453edda5ac32e Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
3 Date: Tue, 30 Apr 2024 09:49:17 +0100
4 Subject: [PATCH] nvmem: lpc18xx_eeprom: 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: Vladimir Zapolskiy <vz@mleia.com>
25 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
26 Link: https://lore.kernel.org/r/20240430084921.33387-8-srinivas.kandagatla@linaro.org
27 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28 ---
29 drivers/nvmem/lpc18xx_eeprom.c | 6 ++----
30 1 file changed, 2 insertions(+), 4 deletions(-)
31
32 --- a/drivers/nvmem/lpc18xx_eeprom.c
33 +++ b/drivers/nvmem/lpc18xx_eeprom.c
34 @@ -249,13 +249,11 @@ err_clk:
35 return ret;
36 }
37
38 -static int lpc18xx_eeprom_remove(struct platform_device *pdev)
39 +static void lpc18xx_eeprom_remove(struct platform_device *pdev)
40 {
41 struct lpc18xx_eeprom_dev *eeprom = platform_get_drvdata(pdev);
42
43 clk_disable_unprepare(eeprom->clk);
44 -
45 - return 0;
46 }
47
48 static const struct of_device_id lpc18xx_eeprom_of_match[] = {
49 @@ -266,7 +264,7 @@ MODULE_DEVICE_TABLE(of, lpc18xx_eeprom_o
50
51 static struct platform_driver lpc18xx_eeprom_driver = {
52 .probe = lpc18xx_eeprom_probe,
53 - .remove = lpc18xx_eeprom_remove,
54 + .remove_new = lpc18xx_eeprom_remove,
55 .driver = {
56 .name = "lpc18xx-eeprom",
57 .of_match_table = lpc18xx_eeprom_of_match,