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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 13, 2023 at 04:07:35PM +0800, 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>
> ---
>  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,

Given that the alignment of =s in sdhci_f_sdh30_driver is very
inconsistent, you might want to consider to do s/\t/ / in it for the two
remaining offenders while touching this anyhow.

With or without that adapted:

Acked-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux