mmc: sh_mmcif: Move dev_err() of mmcif_timeout_work()
authorKouichi Tomita <kouichi.tomita.yn@renesas.com>
Sun, 15 Feb 2015 14:46:47 +0000 (23:46 +0900)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 23 Mar 2015 13:13:43 +0000 (14:13 +0100)
If interruption of command already occurred, mrq pointer in dev_err()
would refer to NULL, because the host-state is changed to STATE_IDLE
and mrq pointer is changed to NULL by interrupt handler.
Therefore dev_err is moved after checking STATE_IDLE.

Signed-off-by: Kouichi Tomita <kouichi.tomita.yn@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sh_mmcif.c

index 7d9d6a3215210f537b1b6e46070b610320f80ff5..e0758044a263bb0fd8aeba7344c84992b4ff605b 100644 (file)
@@ -1312,15 +1312,15 @@ static void mmcif_timeout_work(struct work_struct *work)
                /* Don't run after mmc_remove_host() */
                return;
 
-       dev_err(&host->pd->dev, "Timeout waiting for %u on CMD%u\n",
-               host->wait_for, mrq->cmd->opcode);
-
        spin_lock_irqsave(&host->lock, flags);
        if (host->state == STATE_IDLE) {
                spin_unlock_irqrestore(&host->lock, flags);
                return;
        }
 
+       dev_err(&host->pd->dev, "Timeout waiting for %u on CMD%u\n",
+               host->wait_for, mrq->cmd->opcode);
+
        host->state = STATE_TIMEOUT;
        spin_unlock_irqrestore(&host->lock, flags);