mmc: fix wrong timeout check in mmc_send_status()
authorJongman Heo <jongman.heo@gmail.com>
Sun, 3 Jun 2012 21:32:13 +0000 (21:32 +0000)
committerAndy Fleming <afleming@freescale.com>
Wed, 5 Sep 2012 22:32:41 +0000 (17:32 -0500)
(!timeout) condition check in mmc_send_status() can never be met,
because do-while loop ends up with negative timeout value, -1.

Fix the check to handle TIMEOUT case correctly.

Signed-off-by: Jongman Heo <jongman.heo@gmail.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
drivers/mmc/mmc.c

index fa673cf2c6847128c76fd1fb9b8cf9e46274ccff..89b674bb4b5aea673ae3a749f7f6c472092847a5 100644 (file)
@@ -236,7 +236,7 @@ int mmc_send_status(struct mmc *mmc, int timeout)
        status = (cmd.response[0] & MMC_STATUS_CURR_STATE) >> 9;
        printf("CURR STATE:%d\n", status);
 #endif
-       if (!timeout) {
+       if (timeout <= 0) {
                printf("Timeout waiting card ready\n");
                return TIMEOUT;
        }