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

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Link: https://lore.kernel.org/r/32781a61d729cefcaf15e62df809ce924c504390.1748933789.git.zhoubinbin@loongson.cn
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/via-sdmmc.c

index 9903966c2f5478c458a585f34d96464e0dec5078..3bd49f64899d62d253701dd2a8d94497e2ed777d 100644 (file)
@@ -1100,7 +1100,7 @@ static int via_sd_probe(struct pci_dev *pcidev,
        pci_write_config_byte(pcidev, VIA_CRDR_PCI_WORK_MODE, 0);
        pci_write_config_byte(pcidev, VIA_CRDR_PCI_DBG_MODE, 0);
 
-       mmc = mmc_alloc_host(sizeof(struct via_crdr_mmc_host), &pcidev->dev);
+       mmc = devm_mmc_alloc_host(&pcidev->dev, sizeof(*sdhost));
        if (!mmc) {
                ret = -ENOMEM;
                goto release;
@@ -1115,7 +1115,7 @@ static int via_sd_probe(struct pci_dev *pcidev,
        sdhost->mmiobase = ioremap(base, len);
        if (!sdhost->mmiobase) {
                ret = -ENOMEM;
-               goto free_mmc_host;
+               goto release;
        }
 
        sdhost->sdhc_mmiobase =
@@ -1160,8 +1160,6 @@ static int via_sd_probe(struct pci_dev *pcidev,
 
 unmap:
        iounmap(sdhost->mmiobase);
-free_mmc_host:
-       mmc_free_host(mmc);
 release:
        pci_release_regions(pcidev);
 disable:
@@ -1212,7 +1210,6 @@ static void via_sd_remove(struct pci_dev *pcidev)
        writeb(gatt, sdhost->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT);
 
        iounmap(sdhost->mmiobase);
-       mmc_free_host(sdhost->mmc);
        pci_release_regions(pcidev);
        pci_disable_device(pcidev);