Skip to content

Commit 4998f38

Browse files
author
Uwe Kleine-König
committed
nvdimm/of_pmem: 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. Reviewed-by: Dave Jiang <[email protected]> Link: https://lore.kernel.org/r/8de0900f8c9f40648295fd9e2f445c85b2593d26.1712756722.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <[email protected]>
1 parent 5215582 commit 4998f38

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/nvdimm/of_pmem.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,12 @@ static int of_pmem_region_probe(struct platform_device *pdev)
8484
return 0;
8585
}
8686

87-
static int of_pmem_region_remove(struct platform_device *pdev)
87+
static void of_pmem_region_remove(struct platform_device *pdev)
8888
{
8989
struct of_pmem_private *priv = platform_get_drvdata(pdev);
9090

9191
nvdimm_bus_unregister(priv->bus);
9292
kfree(priv);
93-
94-
return 0;
9593
}
9694

9795
static const struct of_device_id of_pmem_region_match[] = {
@@ -102,7 +100,7 @@ static const struct of_device_id of_pmem_region_match[] = {
102100

103101
static struct platform_driver of_pmem_region_driver = {
104102
.probe = of_pmem_region_probe,
105-
.remove = of_pmem_region_remove,
103+
.remove_new = of_pmem_region_remove,
106104
.driver = {
107105
.name = "of_pmem",
108106
.of_match_table = of_pmem_region_match,

0 commit comments

Comments
 (0)