Commit 52155827 authored by Uwe Kleine-König's avatar Uwe Kleine-König

nvdimm/e820: 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: default avatarDave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/fcb5545d45cf31caee31e0c66ed3521ead12c9b4.1712756722.git.u.kleine-koenig@pengutronix.deSigned-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent 4402a5aa
...@@ -9,12 +9,11 @@ ...@@ -9,12 +9,11 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/numa.h> #include <linux/numa.h>
static int e820_pmem_remove(struct platform_device *pdev) static void e820_pmem_remove(struct platform_device *pdev)
{ {
struct nvdimm_bus *nvdimm_bus = platform_get_drvdata(pdev); struct nvdimm_bus *nvdimm_bus = platform_get_drvdata(pdev);
nvdimm_bus_unregister(nvdimm_bus); nvdimm_bus_unregister(nvdimm_bus);
return 0;
} }
static int e820_register_one(struct resource *res, void *data) static int e820_register_one(struct resource *res, void *data)
...@@ -60,7 +59,7 @@ static int e820_pmem_probe(struct platform_device *pdev) ...@@ -60,7 +59,7 @@ static int e820_pmem_probe(struct platform_device *pdev)
static struct platform_driver e820_pmem_driver = { static struct platform_driver e820_pmem_driver = {
.probe = e820_pmem_probe, .probe = e820_pmem_probe,
.remove = e820_pmem_remove, .remove_new = e820_pmem_remove,
.driver = { .driver = {
.name = "e820_pmem", .name = "e820_pmem",
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment