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

rtc: at91rm9200: 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/20231002080529.2535610-9-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Uwe Kleine-König and committed by
Alexandre Belloni
48bc8830 94a2da3e

+2 -4
+2 -4
drivers/rtc/rtc-at91rm9200.c
··· 558 558 /* 559 559 * Disable and remove the RTC driver 560 560 */ 561 - static int __exit at91_rtc_remove(struct platform_device *pdev) 561 + static void at91_rtc_remove(struct platform_device *pdev) 562 562 { 563 563 /* Disable all interrupts */ 564 564 at91_rtc_write_idr(AT91_RTC_ACKUPD | AT91_RTC_ALARM | ··· 566 566 AT91_RTC_CALEV); 567 567 568 568 clk_disable_unprepare(sclk); 569 - 570 - return 0; 571 569 } 572 570 573 571 static void at91_rtc_shutdown(struct platform_device *pdev) ··· 640 642 * triggering a section mismatch warning. 641 643 */ 642 644 static struct platform_driver at91_rtc_driver __refdata = { 643 - .remove = __exit_p(at91_rtc_remove), 645 + .remove_new = __exit_p(at91_rtc_remove), 644 646 .shutdown = at91_rtc_shutdown, 645 647 .driver = { 646 648 .name = "at91_rtc",