mmc: sdhci: check host->clock before using it as a denominator
[pandora-kernel.git] / drivers / mmc / host / sdhci.c
index 11d031b..89ba451 100644 (file)
@@ -628,9 +628,11 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd)
        /* timeout in us */
        if (!data)
                target_timeout = cmd->cmd_timeout_ms * 1000;
-       else
-               target_timeout = data->timeout_ns / 1000 +
-                       data->timeout_clks / host->clock;
+       else {
+               target_timeout = data->timeout_ns / 1000;
+               if (host->clock)
+                       target_timeout += data->timeout_clks / host->clock;
+       }
 
        /*
         * Figure out needed cycles.