]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mmc: alcor: Use devm_mmc_alloc_host() helper
authorBinbin Zhou <zhoubinbin@loongson.cn>
Tue, 3 Jun 2025 12:25:13 +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: Feng Wei <feng.wei8@zte.com.cn>
Cc: Shao Mingyin <shao.mingyin@zte.com.cn>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Link: https://lore.kernel.org/r/fcb69bf45d8ad4c2653c9e5e912ea8aed77fc3a2.1748933789.git.zhoubinbin@loongson.cn
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/alcor.c

index 24abd3a93da9cb2a760451a6a277befadd72f1ca..288c3a91a0aff7a40e1b02d433665d08e4a0f22c 100644 (file)
@@ -1084,7 +1084,7 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
        struct alcor_sdmmc_host *host;
        int ret;
 
-       mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
+       mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
        if (!mmc) {
                dev_err(&pdev->dev, "Can't allocate MMC\n");
                return -ENOMEM;
@@ -1102,11 +1102,9 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
        ret = devm_request_threaded_irq(&pdev->dev, priv->irq,
                        alcor_irq, alcor_irq_thread, IRQF_SHARED,
                        DRV_NAME_ALCOR_PCI_SDMMC, host);
-
-       if (ret) {
-               dev_err(&pdev->dev, "Failed to get irq for data line\n");
-               goto free_host;
-       }
+       if (ret)
+               return dev_err_probe(&pdev->dev, ret,
+                                    "Failed to get irq for data line\n");
 
        mutex_init(&host->cmd_mutex);
        INIT_DELAYED_WORK(&host->timeout_work, alcor_timeout_timer);
@@ -1115,15 +1113,8 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
        alcor_hw_init(host);
 
        dev_set_drvdata(&pdev->dev, host);
-       ret = mmc_add_host(mmc);
-       if (ret)
-               goto free_host;
 
-       return 0;
-
-free_host:
-       mmc_free_host(mmc);
-       return ret;
+       return mmc_add_host(mmc);
 }
 
 static void alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
@@ -1136,7 +1127,6 @@ static void alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
 
        alcor_hw_uninit(host);
        mmc_remove_host(mmc);
-       mmc_free_host(mmc);
 }
 
 #ifdef CONFIG_PM_SLEEP