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

mailbox: sun6i-msgbox: 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>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>

authored by

Uwe Kleine-König and committed by
Jassi Brar
b8e346bd 0a902f50

+2 -4
+2 -4
drivers/mailbox/sun6i-msgbox.c
··· 287 287 return ret; 288 288 } 289 289 290 - static int sun6i_msgbox_remove(struct platform_device *pdev) 290 + static void sun6i_msgbox_remove(struct platform_device *pdev) 291 291 { 292 292 struct sun6i_msgbox *mbox = platform_get_drvdata(pdev); 293 293 294 294 mbox_controller_unregister(&mbox->controller); 295 295 /* See the comment in sun6i_msgbox_probe about the reset line. */ 296 296 clk_disable_unprepare(mbox->clk); 297 - 298 - return 0; 299 297 } 300 298 301 299 static const struct of_device_id sun6i_msgbox_of_match[] = { ··· 308 310 .of_match_table = sun6i_msgbox_of_match, 309 311 }, 310 312 .probe = sun6i_msgbox_probe, 311 - .remove = sun6i_msgbox_remove, 313 + .remove_new = sun6i_msgbox_remove, 312 314 }; 313 315 module_platform_driver(sun6i_msgbox_driver); 314 316