diff options
| author | Binbin Zhou <zhoubinbin@loongson.cn> | 2025-06-03 20:26:30 +0800 |
|---|---|---|
| committer | Ulf Hansson <ulf.hansson@linaro.org> | 2025-06-24 12:43:23 +0200 |
| commit | 2a52d0c772bc288be1a2f63d69345adcabc4d5c3 (patch) | |
| tree | 22d7c4666f556dfa78edfc3532ed84944c71128c | |
| parent | mmc: moxart-mmc: Use devm_mmc_alloc_host() helper (diff) | |
| download | linux-2a52d0c772bc288be1a2f63d69345adcabc4d5c3.tar.gz linux-2a52d0c772bc288be1a2f63d69345adcabc4d5c3.zip | |
mmc: mvsdio: Use devm_mmc_alloc_host() helper
Use new function devm_mmc_alloc_host() to simplify the code.
Cc: Nicolas Pitre <nico@fluxnic.net>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Link: https://lore.kernel.org/r/ec8a37f8007391fb0835ab239f838517632611ad.1748933789.git.zhoubinbin@loongson.cn
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
| -rw-r--r-- | drivers/mmc/host/mvsdio.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c index 101f36de7b63..a9e6277789ba 100644 --- a/drivers/mmc/host/mvsdio.c +++ b/drivers/mmc/host/mvsdio.c @@ -706,11 +706,9 @@ static int mvsd_probe(struct platform_device *pdev) if (irq < 0) return irq; - mmc = mmc_alloc_host(sizeof(struct mvsd_host), &pdev->dev); - if (!mmc) { - ret = -ENOMEM; - goto out; - } + mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host)); + if (!mmc) + return -ENOMEM; host = mmc_priv(mmc); host->mmc = mmc; @@ -724,11 +722,9 @@ static int mvsd_probe(struct platform_device *pdev) * fixed rate clock). */ host->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(host->clk)) { - dev_err(&pdev->dev, "no clock associated\n"); - ret = -EINVAL; - goto out; - } + if (IS_ERR(host->clk)) + return dev_err_probe(&pdev->dev, -EINVAL, "no clock associated\n"); + clk_prepare_enable(host->clk); mmc->ops = &mvsd_ops; @@ -787,12 +783,7 @@ static int mvsd_probe(struct platform_device *pdev) return 0; out: - if (mmc) { - if (!IS_ERR(host->clk)) - clk_disable_unprepare(host->clk); - mmc_free_host(mmc); - } - + clk_disable_unprepare(host->clk); return ret; } @@ -808,7 +799,6 @@ static void mvsd_remove(struct platform_device *pdev) if (!IS_ERR(host->clk)) clk_disable_unprepare(host->clk); - mmc_free_host(mmc); } static const struct of_device_id mvsdio_dt_ids[] = { |
