Skip to content

Commit 57456ad

Browse files
Uwe Kleine-Königweiny2
authored andcommitted
ndtest: 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 <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Reviewed-by: Dan Williams <[email protected]> Link: https://lore.kernel.org/r/c04bfc941a9f5d249b049572c1ae122fe551ee5d.1709886922.git.u.kleine-koenig@pengutronix.de Signed-off-by: Ira Weiny <[email protected]>
1 parent 1e97469 commit 57456ad

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tools/testing/nvdimm/test/ndtest.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -832,12 +832,11 @@ static int ndtest_bus_register(struct ndtest_priv *p)
832832
return 0;
833833
}
834834

835-
static int ndtest_remove(struct platform_device *pdev)
835+
static void ndtest_remove(struct platform_device *pdev)
836836
{
837837
struct ndtest_priv *p = to_ndtest_priv(&pdev->dev);
838838

839839
nvdimm_bus_unregister(p->bus);
840-
return 0;
841840
}
842841

843842
static int ndtest_probe(struct platform_device *pdev)
@@ -884,7 +883,7 @@ static const struct platform_device_id ndtest_id[] = {
884883

885884
static struct platform_driver ndtest_driver = {
886885
.probe = ndtest_probe,
887-
.remove = ndtest_remove,
886+
.remove_new = ndtest_remove,
888887
.driver = {
889888
.name = KBUILD_MODNAME,
890889
},

0 commit comments

Comments
 (0)