Re: [PATCH 26/58] mmc: f-sdh30: Convert to platform remove callback returning void

From: Adrian Hunter
Date: Fri Jul 14 2023 - 03:51:38 EST


On 13/07/23 11:07, Yangtao Li wrote:
> 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@xxxxxxxxxxxxxx>
> Signed-off-by: Yangtao Li <frank.li@xxxxxxxx>

Doesn't apply anymore. You can check against the "next" branch in:

git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git

> ---
> drivers/mmc/host/sdhci_f_sdh30.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci_f_sdh30.c b/drivers/mmc/host/sdhci_f_sdh30.c
> index a202a69a4b08..6016e183c03c 100644
> --- a/drivers/mmc/host/sdhci_f_sdh30.c
> +++ b/drivers/mmc/host/sdhci_f_sdh30.c
> @@ -208,7 +208,7 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int sdhci_f_sdh30_remove(struct platform_device *pdev)
> +static void sdhci_f_sdh30_remove(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct f_sdhost_priv *priv = sdhci_priv(host);
> @@ -222,8 +222,6 @@ static int sdhci_f_sdh30_remove(struct platform_device *pdev)
>
> sdhci_free_host(host);
> platform_set_drvdata(pdev, NULL);
> -
> - return 0;
> }
>
> #ifdef CONFIG_OF
> @@ -252,7 +250,7 @@ static struct platform_driver sdhci_f_sdh30_driver = {
> .pm = &sdhci_pltfm_pmops,
> },
> .probe = sdhci_f_sdh30_probe,
> - .remove = sdhci_f_sdh30_remove,
> + .remove_new = sdhci_f_sdh30_remove,
> };
>
> module_platform_driver(sdhci_f_sdh30_driver);