Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <u.kleine-koenig@pengutronix.de>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Link: https://lore.kernel.org/r/c04bfc941a9f5d249b049572c1ae122fe551ee5d.1709886922.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Uwe Kleine-König and committed by
Greg Kroah-Hartman
a36b6977 f8a27dfa

+2 -3
+2 -3
tools/testing/nvdimm/test/ndtest.c
··· 830 830 return 0; 831 831 } 832 832 833 - static int ndtest_remove(struct platform_device *pdev) 833 + static void ndtest_remove(struct platform_device *pdev) 834 834 { 835 835 struct ndtest_priv *p = to_ndtest_priv(&pdev->dev); 836 836 837 837 nvdimm_bus_unregister(p->bus); 838 - return 0; 839 838 } 840 839 841 840 static int ndtest_probe(struct platform_device *pdev) ··· 881 882 882 883 static struct platform_driver ndtest_driver = { 883 884 .probe = ndtest_probe, 884 - .remove = ndtest_remove, 885 + .remove_new = ndtest_remove, 885 886 .driver = { 886 887 .name = KBUILD_MODNAME, 887 888 },