mmc: renesas_sdhi: Convert to platform remove callback returning void
authorYangtao Li <frank.li@vivo.com>
Thu, 27 Jul 2023 07:00:45 +0000 (15:00 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 15 Aug 2023 10:48:20 +0000 (12:48 +0200)
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>
drivers/mmc/host/renesas_sdhi.h
drivers/mmc/host/renesas_sdhi_core.c
drivers/mmc/host/renesas_sdhi_internal_dmac.c
drivers/mmc/host/renesas_sdhi_sys_dmac.c

index 68da3da9e2e54eccf99cb6170045adf5ee472a1f..c1fb9740eab0026fde2335b49fe4c67c50d9bcb4 100644 (file)
@@ -101,5 +101,5 @@ int renesas_sdhi_probe(struct platform_device *pdev,
                       const struct tmio_mmc_dma_ops *dma_ops,
                       const struct renesas_sdhi_of_data *of_data,
                       const struct renesas_sdhi_quirks *quirks);
-int renesas_sdhi_remove(struct platform_device *pdev);
+void renesas_sdhi_remove(struct platform_device *pdev);
 #endif
index 10dbdb4abc93ee6649c8e998bab57a9dbe929471..c675dec587efb2255dc360b1bceb87272927f0e7 100644 (file)
@@ -1149,15 +1149,13 @@ efree:
 }
 EXPORT_SYMBOL_GPL(renesas_sdhi_probe);
 
-int renesas_sdhi_remove(struct platform_device *pdev)
+void renesas_sdhi_remove(struct platform_device *pdev)
 {
        struct tmio_mmc_host *host = platform_get_drvdata(pdev);
 
        tmio_mmc_host_remove(host);
        renesas_sdhi_clk_disable(host);
        tmio_mmc_host_free(host);
-
-       return 0;
 }
 EXPORT_SYMBOL_GPL(renesas_sdhi_remove);
 
index 4cc5bcb3213adca013c8bc09f9a7aff186ec7e10..53d34c3eddceb1333246bd63720fef92b7f4650d 100644 (file)
@@ -610,7 +610,7 @@ static struct platform_driver renesas_internal_dmac_sdhi_driver = {
                .of_match_table = renesas_sdhi_internal_dmac_of_match,
        },
        .probe          = renesas_sdhi_internal_dmac_probe,
-       .remove         = renesas_sdhi_remove,
+       .remove_new     = renesas_sdhi_remove,
 };
 
 module_platform_driver(renesas_internal_dmac_sdhi_driver);
index 452982e670d2876a69c45ce3b736a138bc53f7a7..9cf7f9feab72f12b14382017e982b419bac93b05 100644 (file)
@@ -471,7 +471,7 @@ static struct platform_driver renesas_sys_dmac_sdhi_driver = {
                .of_match_table = renesas_sdhi_sys_dmac_of_match,
        },
        .probe          = renesas_sdhi_sys_dmac_probe,
-       .remove         = renesas_sdhi_remove,
+       .remove_new     = renesas_sdhi_remove,
 };
 
 module_platform_driver(renesas_sys_dmac_sdhi_driver);