diff mbox

[PATCH/RFC] mmc: sh_mmcif: Move dev_err() of mmcif_timeout_work()

Message ID 1424011607-3682-2-git-send-email-ykaneko0929@gmail.com (mailing list archive)
State Accepted
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Yoshihiro Kaneko Feb. 15, 2015, 2:46 p.m. UTC
From: Kouichi Tomita <kouichi.tomita.yn@renesas.com>

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>
---

This patch is based on next branch of Chris Ball's mmc tree.

 drivers/mmc/host/sh_mmcif.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Ulf Hansson March 5, 2015, 2:57 p.m. UTC | #1
On 15 February 2015 at 15:46, Yoshihiro Kaneko <ykaneko0929@gmail.com> wrote:
> From: Kouichi Tomita <kouichi.tomita.yn@renesas.com>
>
> 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>

Applied, thanks!

Kind regards
Uffe


> ---
>
> This patch is based on next branch of Chris Ball's mmc tree.
>
>  drivers/mmc/host/sh_mmcif.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index 7d9d6a3..e075804 100644
> --- a/drivers/mmc/host/sh_mmcif.c
> +++ b/drivers/mmc/host/sh_mmcif.c
> @@ -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);
>
> --
> 1.9.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 7d9d6a3..e075804 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -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);