spi/omap-mcspi: check condition also after timeout
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / spi / spi-omap2-mcspi.c
index 893c3d78e426f98253308c0ff336d62dc6168b24..61eef47ae82109d40f549cb4509e890eeb224e08 100644 (file)
@@ -285,8 +285,12 @@ static int mcspi_wait_for_reg_bit(void __iomem *reg, unsigned long bit)
 
        timeout = jiffies + msecs_to_jiffies(1000);
        while (!(__raw_readl(reg) & bit)) {
-               if (time_after(jiffies, timeout))
-                       return -1;
+               if (time_after(jiffies, timeout)) {
+                       if (!(__raw_readl(reg) & bit))
+                               return -ETIMEDOUT;
+                       else
+                               return 0;
+               }
                cpu_relax();
        }
        return 0;