mmc: dw_mmc: replace the bus_hz checking point
authorJaehoon Chung <jh80.chung@samsung.com>
Mon, 3 Mar 2014 02:36:42 +0000 (11:36 +0900)
committerChris Ball <chris@printf.net>
Mon, 12 May 2014 22:04:32 +0000 (18:04 -0400)
It's right to check immediately whether host->bus_hz is assigned or not.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
drivers/mmc/host/dw_mmc.c

index 8da598f8d96bea6fb9924764a6f2264324a36cd7..55c34cb702d411d8b5609e2100822e97f5d0e57c 100644 (file)
@@ -2427,12 +2427,19 @@ int dw_mci_probe(struct dw_mci *host)
                        ret = clk_set_rate(host->ciu_clk, host->pdata->bus_hz);
                        if (ret)
                                dev_warn(host->dev,
-                                        "Unable to set bus rate to %ul\n",
+                                        "Unable to set bus rate to %uHz\n",
                                         host->pdata->bus_hz);
                }
                host->bus_hz = clk_get_rate(host->ciu_clk);
        }
 
+       if (!host->bus_hz) {
+               dev_err(host->dev,
+                       "Platform data must supply bus speed\n");
+               ret = -ENODEV;
+               goto err_clk_ciu;
+       }
+
        if (drv_data && drv_data->init) {
                ret = drv_data->init(host);
                if (ret) {
@@ -2469,13 +2476,6 @@ int dw_mci_probe(struct dw_mci *host)
                }
        }
 
-       if (!host->bus_hz) {
-               dev_err(host->dev,
-                       "Platform data must supply bus speed\n");
-               ret = -ENODEV;
-               goto err_regulator;
-       }
-
        host->quirks = host->pdata->quirks;
 
        spin_lock_init(&host->lock);
@@ -2619,8 +2619,6 @@ err_workqueue:
 err_dmaunmap:
        if (host->use_dma && host->dma_ops->exit)
                host->dma_ops->exit(host);
-
-err_regulator:
        if (host->vmmc)
                regulator_disable(host->vmmc);