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

mmc: renesas_sdhi: 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>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20230727070051.17778-56-frank.li@vivo.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Yangtao Li and committed by
Ulf Hansson
80c602b1 5c57f6c4

+4 -6
+1 -1
drivers/mmc/host/renesas_sdhi.h
··· 101 101 const struct tmio_mmc_dma_ops *dma_ops, 102 102 const struct renesas_sdhi_of_data *of_data, 103 103 const struct renesas_sdhi_quirks *quirks); 104 - int renesas_sdhi_remove(struct platform_device *pdev); 104 + void renesas_sdhi_remove(struct platform_device *pdev); 105 105 #endif
+1 -3
drivers/mmc/host/renesas_sdhi_core.c
··· 1149 1149 } 1150 1150 EXPORT_SYMBOL_GPL(renesas_sdhi_probe); 1151 1151 1152 - int renesas_sdhi_remove(struct platform_device *pdev) 1152 + void renesas_sdhi_remove(struct platform_device *pdev) 1153 1153 { 1154 1154 struct tmio_mmc_host *host = platform_get_drvdata(pdev); 1155 1155 1156 1156 tmio_mmc_host_remove(host); 1157 1157 renesas_sdhi_clk_disable(host); 1158 1158 tmio_mmc_host_free(host); 1159 - 1160 - return 0; 1161 1159 } 1162 1160 EXPORT_SYMBOL_GPL(renesas_sdhi_remove); 1163 1161
+1 -1
drivers/mmc/host/renesas_sdhi_internal_dmac.c
··· 610 610 .of_match_table = renesas_sdhi_internal_dmac_of_match, 611 611 }, 612 612 .probe = renesas_sdhi_internal_dmac_probe, 613 - .remove = renesas_sdhi_remove, 613 + .remove_new = renesas_sdhi_remove, 614 614 }; 615 615 616 616 module_platform_driver(renesas_internal_dmac_sdhi_driver);
+1 -1
drivers/mmc/host/renesas_sdhi_sys_dmac.c
··· 471 471 .of_match_table = renesas_sdhi_sys_dmac_of_match, 472 472 }, 473 473 .probe = renesas_sdhi_sys_dmac_probe, 474 - .remove = renesas_sdhi_remove, 474 + .remove_new = renesas_sdhi_remove, 475 475 }; 476 476 477 477 module_platform_driver(renesas_sys_dmac_sdhi_driver);