]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mmc: sdricoh_cs: Use devm_mmc_alloc_host() helper
authorBinbin Zhou <zhoubinbin@loongson.cn>
Tue, 3 Jun 2025 12:27:20 +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/ce16815710f97e853586a0496c315729bd11fb3f.1748933789.git.zhoubinbin@loongson.cn
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdricoh_cs.c

index 57b8c1a967565484454c156bb44202cb43963cb8..481cb552c2b4dcca6af2180634b1ac635579a6bb 100644 (file)
@@ -403,9 +403,9 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,
        }
        /* allocate privdata */
        mmc = pcmcia_dev->priv =
-           mmc_alloc_host(sizeof(struct sdricoh_host), &pcmcia_dev->dev);
+           devm_mmc_alloc_host(&pcmcia_dev->dev, sizeof(*host));
        if (!mmc) {
-               dev_err(dev, "mmc_alloc_host failed\n");
+               dev_err(dev, "devm_mmc_alloc_host failed\n");
                result = -ENOMEM;
                goto unmap_io;
        }
@@ -431,7 +431,7 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,
        if (sdricoh_reset(host)) {
                dev_dbg(dev, "could not reset\n");
                result = -EIO;
-               goto free_host;
+               goto unmap_io;
        }
 
        result = mmc_add_host(mmc);
@@ -440,8 +440,6 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,
                dev_dbg(dev, "mmc host registered\n");
                return 0;
        }
-free_host:
-       mmc_free_host(mmc);
 unmap_io:
        pci_iounmap(pci_dev, iobase);
        return result;
@@ -483,10 +481,8 @@ static void sdricoh_pcmcia_detach(struct pcmcia_device *link)
                mmc_remove_host(mmc);
                pci_iounmap(host->pci_dev, host->iobase);
                pci_dev_put(host->pci_dev);
-               mmc_free_host(mmc);
        }
        pcmcia_disable_device(link);
-
 }
 
 #ifdef CONFIG_PM