]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mmc: au1xmmc: Use devm_mmc_alloc_host() helper
authorBinbin Zhou <zhoubinbin@loongson.cn>
Tue, 3 Jun 2025 12:25:15 +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: Manuel Lauss <manuel.lauss@gmail.com>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Link: https://lore.kernel.org/r/7da94643484f7184be40fa517a8a74ce3cdefe19.1748933789.git.zhoubinbin@loongson.cn
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/au1xmmc.c

index 057d42307832c8c39fb4d3e0dda249c082adaa6d..85470773650d68f065f2085662827925a719e80c 100644 (file)
@@ -937,11 +937,10 @@ static int au1xmmc_probe(struct platform_device *pdev)
        struct resource *r;
        int ret, iflag;
 
-       mmc = mmc_alloc_host(sizeof(struct au1xmmc_host), &pdev->dev);
+       mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
        if (!mmc) {
                dev_err(&pdev->dev, "no memory for mmc_host\n");
-               ret = -ENOMEM;
-               goto out0;
+               return -ENOMEM;
        }
 
        host = mmc_priv(mmc);
@@ -953,14 +952,14 @@ static int au1xmmc_probe(struct platform_device *pdev)
        r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!r) {
                dev_err(&pdev->dev, "no mmio defined\n");
-               goto out1;
+               return ret;
        }
 
        host->ioarea = request_mem_region(r->start, resource_size(r),
                                           pdev->name);
        if (!host->ioarea) {
                dev_err(&pdev->dev, "mmio already in use\n");
-               goto out1;
+               return ret;
        }
 
        host->iobase = ioremap(r->start, 0x3c);
@@ -1109,9 +1108,6 @@ out3:
 out2:
        release_resource(host->ioarea);
        kfree(host->ioarea);
-out1:
-       mmc_free_host(mmc);
-out0:
        return ret;
 }
 
@@ -1151,8 +1147,6 @@ static void au1xmmc_remove(struct platform_device *pdev)
                iounmap((void *)host->iobase);
                release_resource(host->ioarea);
                kfree(host->ioarea);
-
-               mmc_free_host(host->mmc);
        }
 }