Skip to content

Commit baa74c2

Browse files
AaronDotUlf Hansson
authored andcommitted
mmc: meson-mx-sdio: Use devm_mmc_alloc_host() helper
Use new function devm_mmc_alloc_host() to simplify the code. Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent b63f8fc commit baa74c2

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

drivers/mmc/host/meson-mx-sdio.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
648648
else if (IS_ERR(slot_pdev))
649649
return PTR_ERR(slot_pdev);
650650

651-
mmc = mmc_alloc_host(sizeof(*host), &slot_pdev->dev);
651+
mmc = devm_mmc_alloc_host(&slot_pdev->dev, sizeof(*host));
652652
if (!mmc) {
653653
ret = -ENOMEM;
654654
goto error_unregister_slot_pdev;
@@ -667,38 +667,38 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
667667
&meson_mx_sdio_regmap_config);
668668
if (IS_ERR(host->regmap)) {
669669
ret = PTR_ERR(host->regmap);
670-
goto error_free_mmc;
670+
goto error_unregister_slot_pdev;
671671
}
672672

673673
irq = platform_get_irq(pdev, 0);
674674
if (irq < 0) {
675675
ret = irq;
676-
goto error_free_mmc;
676+
goto error_unregister_slot_pdev;
677677
}
678678

679679
ret = devm_request_threaded_irq(host->controller_dev, irq,
680680
meson_mx_mmc_irq,
681681
meson_mx_mmc_irq_thread, IRQF_ONESHOT,
682682
NULL, host);
683683
if (ret)
684-
goto error_free_mmc;
684+
goto error_unregister_slot_pdev;
685685

686686
core_clk = devm_clk_get_enabled(host->controller_dev, "core");
687687
if (IS_ERR(core_clk)) {
688688
ret = PTR_ERR(core_clk);
689-
goto error_free_mmc;
689+
goto error_unregister_slot_pdev;
690690
}
691691

692692
host->cfg_div_clk = meson_mx_mmc_register_clk(&pdev->dev, base);
693693
if (IS_ERR(host->cfg_div_clk)) {
694694
ret = PTR_ERR(host->cfg_div_clk);
695-
goto error_free_mmc;
695+
goto error_unregister_slot_pdev;
696696
}
697697

698698
ret = clk_prepare_enable(host->cfg_div_clk);
699699
if (ret) {
700700
dev_err(host->controller_dev, "Failed to enable MMC clock\n");
701-
goto error_free_mmc;
701+
goto error_unregister_slot_pdev;
702702
}
703703

704704
conf = 0;
@@ -718,8 +718,6 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
718718

719719
error_disable_div_clk:
720720
clk_disable_unprepare(host->cfg_div_clk);
721-
error_free_mmc:
722-
mmc_free_host(mmc);
723721
error_unregister_slot_pdev:
724722
of_platform_device_destroy(&slot_pdev->dev, NULL);
725723
return ret;
@@ -737,8 +735,6 @@ static void meson_mx_mmc_remove(struct platform_device *pdev)
737735
of_platform_device_destroy(slot_dev, NULL);
738736

739737
clk_disable_unprepare(host->cfg_div_clk);
740-
741-
mmc_free_host(host->mmc);
742738
}
743739

744740
static const struct of_device_id meson_mx_mmc_of_match[] = {

0 commit comments

Comments
 (0)