From ecb4728dd7ea68d5ba042a36cb2deaa6c9e8e9a0 Mon Sep 17 00:00:00 2001 From: Binbin Zhou Date: Tue, 3 Jun 2025 20:27:05 +0800 Subject: [PATCH] mmc: omap_hsmmc: Use devm_mmc_alloc_host() helper Use new function devm_mmc_alloc_host() to simplify the code. Reviewed-by: Huacai Chen Signed-off-by: Binbin Zhou Link: https://lore.kernel.org/r/bd5dd68556d8530295bb61dc44ac68b619130d1f.1748933789.git.zhoubinbin@loongson.cn Signed-off-by: Ulf Hansson --- drivers/mmc/host/omap_hsmmc.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 59e36e0ebbbf7..bf3b9f5b067c9 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -1798,15 +1798,13 @@ static int omap_hsmmc_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - mmc = mmc_alloc_host(sizeof(struct omap_hsmmc_host), &pdev->dev); - if (!mmc) { - ret = -ENOMEM; - goto err; - } + mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host)); + if (!mmc) + return -ENOMEM; ret = mmc_of_parse(mmc); if (ret) - goto err1; + return ret; host = mmc_priv(mmc); host->mmc = mmc; @@ -1842,7 +1840,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) if (IS_ERR(host->fclk)) { ret = PTR_ERR(host->fclk); host->fclk = NULL; - goto err1; + return ret; } if (host->pdata->controller_flags & OMAP_HSMMC_BROKEN_MULTIBLOCK_READ) { @@ -1973,9 +1971,6 @@ err_irq: pm_runtime_put_sync(host->dev); pm_runtime_disable(host->dev); clk_disable_unprepare(host->dbclk); -err1: - mmc_free_host(mmc); -err: return ret; } @@ -1995,8 +1990,6 @@ static void omap_hsmmc_remove(struct platform_device *pdev) pm_runtime_disable(host->dev); device_init_wakeup(&pdev->dev, false); clk_disable_unprepare(host->dbclk); - - mmc_free_host(host->mmc); } #ifdef CONFIG_PM_SLEEP -- 2.47.2