]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mmc: davinci_mmc: Use devm_mmc_alloc_host() helper
authorBinbin Zhou <zhoubinbin@loongson.cn>
Tue, 3 Jun 2025 12:25:36 +0000 (20:25 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 24 Jun 2025 10:43:22 +0000 (12:43 +0200)
Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Bastien Curutchet <bastien.curutchet@bootlin.com>
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Link: https://lore.kernel.org/r/bbdbdbe746fd227384d562e78bde98fba13f43e7.1748933789.git.zhoubinbin@loongson.cn
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/davinci_mmc.c

index cde4c4339ab75a75d95d7b887255164e65e45191..c691f1b603953f28e106942080a3da72f72d90c1 100644 (file)
@@ -1203,7 +1203,7 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
        if (!mem)
                return -EBUSY;
 
-       mmc = mmc_alloc_host(sizeof(struct mmc_davinci_host), &pdev->dev);
+       mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
        if (!mmc)
                return -ENOMEM;
 
@@ -1212,19 +1212,16 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
 
        host->mem_res = mem;
        host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
-       if (!host->base) {
-               ret = -ENOMEM;
-               goto ioremap_fail;
-       }
+       if (!host->base)
+               return -ENOMEM;
 
        host->clk = devm_clk_get(&pdev->dev, NULL);
-       if (IS_ERR(host->clk)) {
-               ret = PTR_ERR(host->clk);
-               goto clk_get_fail;
-       }
+       if (IS_ERR(host->clk))
+               return PTR_ERR(host->clk);
+
        ret = clk_prepare_enable(host->clk);
        if (ret)
-               goto clk_prepare_enable_fail;
+               return ret;
 
        host->mmc_input_clk = clk_get_rate(host->clk);
 
@@ -1336,10 +1333,6 @@ cpu_freq_fail:
 parse_fail:
 dma_probe_defer:
        clk_disable_unprepare(host->clk);
-clk_prepare_enable_fail:
-clk_get_fail:
-ioremap_fail:
-       mmc_free_host(mmc);
 
        return ret;
 }
@@ -1352,7 +1345,6 @@ static void davinci_mmcsd_remove(struct platform_device *pdev)
        mmc_davinci_cpufreq_deregister(host);
        davinci_release_dma_channels(host);
        clk_disable_unprepare(host->clk);
-       mmc_free_host(host->mmc);
 }
 
 #ifdef CONFIG_PM