Skip to content

Commit 693d2f6

Browse files
Uwe Kleine-Königgregkh
authored andcommitted
nvmem: lpc18xx_eeprom: Convert to platform remove callback returning void
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 <u.kleine-koenig@pengutronix.de> Acked-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20240430084921.33387-8-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8d8fc14 commit 693d2f6

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/nvmem/lpc18xx_eeprom.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,11 @@ static int lpc18xx_eeprom_probe(struct platform_device *pdev)
249249
return ret;
250250
}
251251

252-
static int lpc18xx_eeprom_remove(struct platform_device *pdev)
252+
static void lpc18xx_eeprom_remove(struct platform_device *pdev)
253253
{
254254
struct lpc18xx_eeprom_dev *eeprom = platform_get_drvdata(pdev);
255255

256256
clk_disable_unprepare(eeprom->clk);
257-
258-
return 0;
259257
}
260258

261259
static const struct of_device_id lpc18xx_eeprom_of_match[] = {
@@ -266,7 +264,7 @@ MODULE_DEVICE_TABLE(of, lpc18xx_eeprom_of_match);
266264

267265
static struct platform_driver lpc18xx_eeprom_driver = {
268266
.probe = lpc18xx_eeprom_probe,
269-
.remove = lpc18xx_eeprom_remove,
267+
.remove_new = lpc18xx_eeprom_remove,
270268
.driver = {
271269
.name = "lpc18xx-eeprom",
272270
.of_match_table = lpc18xx_eeprom_of_match,

0 commit comments

Comments
 (0)