@@ -640,7 +640,7 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
else if (IS_ERR(slot_pdev))
return PTR_ERR(slot_pdev);
- mmc = mmc_alloc_host(sizeof(*host), &slot_pdev->dev);
+ mmc = devm_mmc_alloc_host(&slot_pdev->dev, sizeof(*host));
if (!mmc) {
ret = -ENOMEM;
goto error_unregister_slot_pdev;
@@ -658,13 +658,13 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
host->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(host->base)) {
ret = PTR_ERR(host->base);
- goto error_free_mmc;
+ goto error_unregister_slot_pdev;
}
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
ret = irq;
- goto error_free_mmc;
+ goto error_unregister_slot_pdev;
}
ret = devm_request_threaded_irq(host->controller_dev, irq,
@@ -672,28 +672,28 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
meson_mx_mmc_irq_thread, IRQF_ONESHOT,
NULL, host);
if (ret)
- goto error_free_mmc;
+ goto error_unregister_slot_pdev;
host->core_clk = devm_clk_get(host->controller_dev, "core");
if (IS_ERR(host->core_clk)) {
ret = PTR_ERR(host->core_clk);
- goto error_free_mmc;
+ goto error_unregister_slot_pdev;
}
host->parent_clk = devm_clk_get(host->controller_dev, "clkin");
if (IS_ERR(host->parent_clk)) {
ret = PTR_ERR(host->parent_clk);
- goto error_free_mmc;
+ goto error_unregister_slot_pdev;
}
ret = meson_mx_mmc_register_clks(host);
if (ret)
- goto error_free_mmc;
+ goto error_unregister_slot_pdev;
ret = clk_prepare_enable(host->core_clk);
if (ret) {
dev_err(host->controller_dev, "Failed to enable core clock\n");
- goto error_free_mmc;
+ goto error_unregister_slot_pdev;
}
ret = clk_prepare_enable(host->cfg_div_clk);
@@ -721,8 +721,6 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
clk_disable_unprepare(host->cfg_div_clk);
error_disable_core_clk:
clk_disable_unprepare(host->core_clk);
-error_free_mmc:
- mmc_free_host(mmc);
error_unregister_slot_pdev:
of_platform_device_destroy(&slot_pdev->dev, NULL);
return ret;
@@ -741,8 +739,6 @@ static void meson_mx_mmc_remove(struct platform_device *pdev)
clk_disable_unprepare(host->cfg_div_clk);
clk_disable_unprepare(host->core_clk);
-
- mmc_free_host(host->mmc);
}
static const struct of_device_id meson_mx_mmc_of_match[] = {
Use new function devm_mmc_alloc_host() to simplify the code. Cc: Neil Armstrong <neil.armstrong@linaro.org> Cc: Kevin Hilman <khilman@baylibre.com> Cc: Jerome Brunet <jbrunet@baylibre.com> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Cc: linux-amlogic@lists.infradead.org Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> --- drivers/mmc/host/meson-mx-sdio.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)