Skip to content

Commit f52221d

Browse files
Uwe Kleine-Königmiquelraynal
authored andcommitted
mtd: rawnand: txx9ndfmc: 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> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20231102220246.3336154-10-u.kleine-koenig@pengutronix.de
1 parent 354dbdc commit f52221d

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/mtd/nand/raw/txx9ndfmc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ static int txx9ndfmc_probe(struct platform_device *dev)
369369
return 0;
370370
}
371371

372-
static int txx9ndfmc_remove(struct platform_device *dev)
372+
static void txx9ndfmc_remove(struct platform_device *dev)
373373
{
374374
struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev);
375375
int ret, i;
@@ -390,7 +390,6 @@ static int txx9ndfmc_remove(struct platform_device *dev)
390390
kfree(txx9_priv->mtdname);
391391
kfree(txx9_priv);
392392
}
393-
return 0;
394393
}
395394

396395
#ifdef CONFIG_PM
@@ -406,7 +405,7 @@ static int txx9ndfmc_resume(struct platform_device *dev)
406405

407406
static struct platform_driver txx9ndfmc_driver = {
408407
.probe = txx9ndfmc_probe,
409-
.remove = txx9ndfmc_remove,
408+
.remove_new = txx9ndfmc_remove,
410409
.resume = txx9ndfmc_resume,
411410
.driver = {
412411
.name = "txx9ndfmc",

0 commit comments

Comments
 (0)