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

mmc: alcor: 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 (mostly) ignored
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.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
Link: https://lore.kernel.org/r/20230727070051.17778-40-frank.li@vivo.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Yangtao Li and committed by
Ulf Hansson
9f13caa4 a7dde463

+2 -4
+2 -4
drivers/mmc/host/alcor.c
··· 1125 1125 return ret; 1126 1126 } 1127 1127 1128 - static int alcor_pci_sdmmc_drv_remove(struct platform_device *pdev) 1128 + static void alcor_pci_sdmmc_drv_remove(struct platform_device *pdev) 1129 1129 { 1130 1130 struct alcor_sdmmc_host *host = dev_get_drvdata(&pdev->dev); 1131 1131 struct mmc_host *mmc = mmc_from_priv(host); ··· 1136 1136 alcor_hw_uninit(host); 1137 1137 mmc_remove_host(mmc); 1138 1138 mmc_free_host(mmc); 1139 - 1140 - return 0; 1141 1139 } 1142 1140 1143 1141 #ifdef CONFIG_PM_SLEEP ··· 1175 1177 1176 1178 static struct platform_driver alcor_pci_sdmmc_driver = { 1177 1179 .probe = alcor_pci_sdmmc_drv_probe, 1178 - .remove = alcor_pci_sdmmc_drv_remove, 1180 + .remove_new = alcor_pci_sdmmc_drv_remove, 1179 1181 .id_table = alcor_pci_sdmmc_ids, 1180 1182 .driver = { 1181 1183 .name = DRV_NAME_ALCOR_PCI_SDMMC,