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

ptp: ptp_dte: 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: Richard Cochran <richardcochran@gmail.com>
Link: https://lore.kernel.org/r/e8a0de7e8e6d642242350360a938132c7ba0488e.1712734365.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Uwe Kleine-König and committed by
Jakub Kicinski
5c025082 32080ec2

+2 -4
+2 -4
drivers/ptp/ptp_dte.c
··· 258 258 return 0; 259 259 } 260 260 261 - static int ptp_dte_remove(struct platform_device *pdev) 261 + static void ptp_dte_remove(struct platform_device *pdev) 262 262 { 263 263 struct ptp_dte *ptp_dte = platform_get_drvdata(pdev); 264 264 u8 i; ··· 267 267 268 268 for (i = 0; i < DTE_NUM_REGS_TO_RESTORE; i++) 269 269 writel(0, ptp_dte->regs + (i * sizeof(u32))); 270 - 271 - return 0; 272 270 } 273 271 274 272 #ifdef CONFIG_PM_SLEEP ··· 327 329 .of_match_table = ptp_dte_of_match, 328 330 }, 329 331 .probe = ptp_dte_probe, 330 - .remove = ptp_dte_remove, 332 + .remove_new = ptp_dte_remove, 331 333 }; 332 334 module_platform_driver(ptp_dte_driver); 333 335