[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230713090840.dc2ejoz6cieq4dyg@pengutronix.de>
Date: Thu, 13 Jul 2023 11:08:40 +0200
From: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To: Yangtao Li <frank.li@...o.com>
Cc: Adrian Hunter <adrian.hunter@...el.com>,
Ulf Hansson <ulf.hansson@...aro.org>,
linux-mmc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 24/58] mmc: sdhci_am654: Convert to platform remove
callback returning void
On Thu, Jul 13, 2023 at 04:07:33PM +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@...gutronix.de>
> Signed-off-by: Yangtao Li <frank.li@...o.com>
> ---
> drivers/mmc/host/sdhci_am654.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
> index 7cdf0f54e3a5..3cfaf7dca274 100644
> --- a/drivers/mmc/host/sdhci_am654.c
> +++ b/drivers/mmc/host/sdhci_am654.c
> @@ -866,7 +866,7 @@ static int sdhci_am654_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int sdhci_am654_remove(struct platform_device *pdev)
> +static void sdhci_am654_remove(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> @@ -874,14 +874,13 @@ static int sdhci_am654_remove(struct platform_device *pdev)
>
> ret = pm_runtime_resume_and_get(&pdev->dev);
> if (ret < 0)
> - return ret;
> + return;
This is changing semantics. You shouldn't ignore errors here. This is
one of the cases where a driver leaks resources. You need something like
22f407278ea43df46f90cece6595e5e8a0d5447c here.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists