mmc: host: omap_hsmmc: avoid possible overflow of timeout value
[pandora-kernel.git] / drivers / mmc / host / omap_hsmmc.c
index d5fe43d..2b47f34 100644 (file)
@@ -1499,10 +1499,11 @@ static int omap_hsmmc_start_dma_transfer(struct omap_hsmmc_host *host,
 }
 
 static void set_data_timeout(struct omap_hsmmc_host *host,
-                            unsigned int timeout_ns,
+                            unsigned long long timeout_ns,
                             unsigned int timeout_clks)
 {
-       unsigned int timeout, cycle_ns;
+       unsigned long long timeout = timeout_ns;
+       unsigned int cycle_ns;
        uint32_t reg, clkd, dto = 0;
 
        reg = OMAP_HSMMC_READ(host->base, SYSCTL);
@@ -1511,7 +1512,7 @@ static void set_data_timeout(struct omap_hsmmc_host *host,
                clkd = 1;
 
        cycle_ns = 1000000000 / (clk_get_rate(host->fclk) / clkd);
-       timeout = timeout_ns / cycle_ns;
+       do_div(timeout, cycle_ns);
        timeout += timeout_clks;
        if (timeout) {
                while ((timeout & 0x80000000) == 0) {
@@ -2188,9 +2189,7 @@ static int omap_hsmmc_suspend(struct device *dev)
                } else {
                        host->suspended = 0;
                        if (host->pdata->resume) {
-                               ret = host->pdata->resume(&pdev->dev,
-                                                         host->slot_id);
-                               if (ret)
+                               if (host->pdata->resume(&pdev->dev, host->slot_id))
                                        dev_dbg(mmc_dev(host->mmc),
                                                "Unmask interrupt failed\n");
                        }