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

serial: altera_jtaguart: 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: Tobias Klauser <tklauser@distanz.ch>
Link: https://lore.kernel.org/r/20231110152927.70601-5-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
c1f5edac 7e1efdf8

+2 -4
+2 -4
drivers/tty/serial/altera_jtaguart.c
··· 425 425 return 0; 426 426 } 427 427 428 - static int altera_jtaguart_remove(struct platform_device *pdev) 428 + static void altera_jtaguart_remove(struct platform_device *pdev) 429 429 { 430 430 struct uart_port *port; 431 431 int i = pdev->id; ··· 436 436 port = &altera_jtaguart_ports[i]; 437 437 uart_remove_one_port(&altera_jtaguart_driver, port); 438 438 iounmap(port->membase); 439 - 440 - return 0; 441 439 } 442 440 443 441 #ifdef CONFIG_OF ··· 449 451 450 452 static struct platform_driver altera_jtaguart_platform_driver = { 451 453 .probe = altera_jtaguart_probe, 452 - .remove = altera_jtaguart_remove, 454 + .remove_new = altera_jtaguart_remove, 453 455 .driver = { 454 456 .name = DRV_NAME, 455 457 .of_match_table = of_match_ptr(altera_jtaguart_match),