lkml.org 
[lkml]   [2020]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] mmc: sdhci-sprd: Fix some resource leaks in the remove function
+ cc: Billows

Hi Christophe,
On Fri, Dec 18, 2020 at 4:50 AM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> 'sdhci_remove_host()' and 'sdhci_pltfm_free()' should be used in place of
> 'mmc_remove_host()' and 'mmc_free_host()'.
>
> This avoids some resource leaks, is more in line with the error handling
> path of the probe function, and is more consistent with other drivers.
>
> Fixes: fb8bd90f83c4 ("mmc: sdhci-sprd: Add Spreadtrum's initial host controller")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Other adjustment may be needed.
> I'm not sure at all of the 0 passed to 'sdhci_remove_host()'. Some drivers
> pass 0, some have some more complicated computation.
> ---
> drivers/mmc/host/sdhci-sprd.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c
> index f85171edabeb..5dc36efff47f 100644
> --- a/drivers/mmc/host/sdhci-sprd.c
> +++ b/drivers/mmc/host/sdhci-sprd.c
> @@ -708,14 +708,14 @@ static int sdhci_sprd_remove(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct sdhci_sprd_host *sprd_host = TO_SPRD_HOST(host);
> - struct mmc_host *mmc = host->mmc;
>
> - mmc_remove_host(mmc);
> + sdhci_remove_host(host, 0);
> +
> clk_disable_unprepare(sprd_host->clk_sdio);
> clk_disable_unprepare(sprd_host->clk_enable);
> clk_disable_unprepare(sprd_host->clk_2x_enable);
>
> - mmc_free_host(mmc);
> + sdhci_pltfm_free(pdev);

I saw a lot of drivers also use mmc_free_host().
Do you have patches elsewhere to clean them?

Thanks,
-Orson

>
> return 0;
> }
> --
> 2.27.0
>

\
 
 \ /
  Last update: 2020-12-17 23:57    [W:0.258 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site