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

memstick: rtsx_usb_ms: 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/80969cc7c08c613753bdf2270304983ed0dcc2a0.1712757795.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Uwe Kleine-König and committed by
Ulf Hansson
f16d1b8c 8401659f

+2 -4
+2 -4
drivers/memstick/host/rtsx_usb_ms.c
··· 805 805 return err; 806 806 } 807 807 808 - static int rtsx_usb_ms_drv_remove(struct platform_device *pdev) 808 + static void rtsx_usb_ms_drv_remove(struct platform_device *pdev) 809 809 { 810 810 struct rtsx_usb_ms *host = platform_get_drvdata(pdev); 811 811 struct memstick_host *msh = host->msh; ··· 840 840 ": Realtek USB Memstick controller has been removed\n"); 841 841 memstick_free_host(msh); 842 842 platform_set_drvdata(pdev, NULL); 843 - 844 - return 0; 845 843 } 846 844 847 845 static struct platform_device_id rtsx_usb_ms_ids[] = { ··· 853 855 854 856 static struct platform_driver rtsx_usb_ms_driver = { 855 857 .probe = rtsx_usb_ms_drv_probe, 856 - .remove = rtsx_usb_ms_drv_remove, 858 + .remove_new = rtsx_usb_ms_drv_remove, 857 859 .id_table = rtsx_usb_ms_ids, 858 860 .driver = { 859 861 .name = "rtsx_usb_ms",