Skip to content

Commit

Permalink
mmc: sdhci-sprd: Fix some resource leaks in the remove function
Browse files Browse the repository at this point in the history
'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: fb8bd90 ("mmc: sdhci-sprd: Add Spreadtrum's initial host controller")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Orson Zhai <orson.zhai@gmail.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20201217204236.163446-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
  • Loading branch information
Christophe JAILLET authored and Ulf Hansson committed Feb 1, 2021
1 parent 5d15cbf commit c9c256a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/mmc/host/sdhci-sprd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

return 0;
}
Expand Down

0 comments on commit c9c256a

Please sign in to comment.