forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/mmc/host/wmt-sdmmc.c
....@@ -1,12 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * WM8505/WM8650 SD/MMC Host Controller
34 *
45 * Copyright (C) 2010 Tony Prisk
56 * Copyright (C) 2008 WonderMedia Technologies, Inc.
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation
107 */
118
129 #include <linux/init.h>
....@@ -19,7 +16,6 @@
1916 #include <linux/io.h>
2017 #include <linux/irq.h>
2118 #include <linux/clk.h>
22
-#include <linux/gpio.h>
2319 #include <linux/interrupt.h>
2420
2521 #include <linux/of.h>
....@@ -853,7 +849,7 @@
853849 if (IS_ERR(priv->clk_sdmmc)) {
854850 dev_err(&pdev->dev, "Error getting clock\n");
855851 ret = PTR_ERR(priv->clk_sdmmc);
856
- goto fail5;
852
+ goto fail5_and_a_half;
857853 }
858854
859855 ret = clk_prepare_enable(priv->clk_sdmmc);
....@@ -863,13 +859,20 @@
863859 /* configure the controller to a known 'ready' state */
864860 wmt_reset_hardware(mmc);
865861
866
- mmc_add_host(mmc);
862
+ ret = mmc_add_host(mmc);
863
+ if (ret)
864
+ goto fail7;
867865
868866 dev_info(&pdev->dev, "WMT SDHC Controller initialized\n");
869867
870868 return 0;
869
+fail7:
870
+ clk_disable_unprepare(priv->clk_sdmmc);
871871 fail6:
872872 clk_put(priv->clk_sdmmc);
873
+fail5_and_a_half:
874
+ dma_free_coherent(&pdev->dev, mmc->max_blk_count * 16,
875
+ priv->dma_desc_buffer, priv->dma_desc_device_addr);
873876 fail5:
874877 free_irq(dma_irq, priv);
875878 fail4: