Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: au1xmmc: Use devm_mmc_alloc_host() helper

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>

authored by

Binbin Zhou and committed by
Ulf Hansson
16ca54d0 56637056

+4 -10
+4 -10
drivers/mmc/host/au1xmmc.c
··· 937 937 struct resource *r; 938 938 int ret, iflag; 939 939 940 - mmc = mmc_alloc_host(sizeof(struct au1xmmc_host), &pdev->dev); 940 + mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host)); 941 941 if (!mmc) { 942 942 dev_err(&pdev->dev, "no memory for mmc_host\n"); 943 - ret = -ENOMEM; 944 - goto out0; 943 + return -ENOMEM; 945 944 } 946 945 947 946 host = mmc_priv(mmc); ··· 952 953 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 953 954 if (!r) { 954 955 dev_err(&pdev->dev, "no mmio defined\n"); 955 - goto out1; 956 + return ret; 956 957 } 957 958 958 959 host->ioarea = request_mem_region(r->start, resource_size(r), 959 960 pdev->name); 960 961 if (!host->ioarea) { 961 962 dev_err(&pdev->dev, "mmio already in use\n"); 962 - goto out1; 963 + return ret; 963 964 } 964 965 965 966 host->iobase = ioremap(r->start, 0x3c); ··· 1108 1109 out2: 1109 1110 release_resource(host->ioarea); 1110 1111 kfree(host->ioarea); 1111 - out1: 1112 - mmc_free_host(mmc); 1113 - out0: 1114 1112 return ret; 1115 1113 } 1116 1114 ··· 1147 1151 iounmap((void *)host->iobase); 1148 1152 release_resource(host->ioarea); 1149 1153 kfree(host->ioarea); 1150 - 1151 - mmc_free_host(host->mmc); 1152 1154 } 1153 1155 } 1154 1156