Skip to content

Commit 8df8284

Browse files
Uwe Kleine-Königdtor
authored andcommitted
Input: xilinx_ps2 - 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]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent e453a3e commit 8df8284

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/input/serio/xilinx_ps2.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ static int xps2_of_probe(struct platform_device *ofdev)
329329
* if the driver module is being unloaded. It frees any resources allocated to
330330
* the device.
331331
*/
332-
static int xps2_of_remove(struct platform_device *of_dev)
332+
static void xps2_of_remove(struct platform_device *of_dev)
333333
{
334334
struct xps2data *drvdata = platform_get_drvdata(of_dev);
335335
struct resource r_mem; /* IO mem resources */
@@ -344,8 +344,6 @@ static int xps2_of_remove(struct platform_device *of_dev)
344344
release_mem_region(r_mem.start, resource_size(&r_mem));
345345

346346
kfree(drvdata);
347-
348-
return 0;
349347
}
350348

351349
/* Match table for of_platform binding */
@@ -361,7 +359,7 @@ static struct platform_driver xps2_of_driver = {
361359
.of_match_table = xps2_of_match,
362360
},
363361
.probe = xps2_of_probe,
364-
.remove = xps2_of_remove,
362+
.remove_new = xps2_of_remove,
365363
};
366364
module_platform_driver(xps2_of_driver);
367365

0 commit comments

Comments
 (0)