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
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
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.
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().
20 Trivially convert this driver from always returning zero in the remove
21 callback to the void returning variant.
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>
29 drivers/nvmem/lpc18xx_eeprom.c | 6 ++----
30 1 file changed, 2 insertions(+), 4 deletions(-)
32 --- a/drivers/nvmem/lpc18xx_eeprom.c
33 +++ b/drivers/nvmem/lpc18xx_eeprom.c
34 @@ -249,13 +249,11 @@ err_clk:
38 -static int lpc18xx_eeprom_remove(struct platform_device *pdev)
39 +static void lpc18xx_eeprom_remove(struct platform_device *pdev)
41 struct lpc18xx_eeprom_dev *eeprom = platform_get_drvdata(pdev);
43 clk_disable_unprepare(eeprom->clk);
48 static const struct of_device_id lpc18xx_eeprom_of_match[] = {
49 @@ -266,7 +264,7 @@ MODULE_DEVICE_TABLE(of, lpc18xx_eeprom_o
51 static struct platform_driver lpc18xx_eeprom_driver = {
52 .probe = lpc18xx_eeprom_probe,
53 - .remove = lpc18xx_eeprom_remove,
54 + .remove_new = lpc18xx_eeprom_remove,
56 .name = "lpc18xx-eeprom",
57 .of_match_table = lpc18xx_eeprom_of_match,