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.

powerpc/powernv: 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>
Link: https://lore.kernel.org/r/20240410124707.194228-2-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
2193014f f0a816fb

+2 -3
+2 -3
drivers/char/powernv-op-panel.c
··· 195 195 return rc; 196 196 } 197 197 198 - static int oppanel_remove(struct platform_device *pdev) 198 + static void oppanel_remove(struct platform_device *pdev) 199 199 { 200 200 misc_deregister(&oppanel_dev); 201 201 kfree(oppanel_lines); 202 202 kfree(oppanel_data); 203 - return 0; 204 203 } 205 204 206 205 static const struct of_device_id oppanel_match[] = { ··· 213 214 .of_match_table = oppanel_match, 214 215 }, 215 216 .probe = oppanel_probe, 216 - .remove = oppanel_remove, 217 + .remove_new = oppanel_remove, 217 218 }; 218 219 219 220 module_platform_driver(oppanel_driver);