Commit 93a99e8a authored by Phong Tran's avatar Phong Tran Committed by Greg Kroah-Hartman

greybus: sdio: correct the usage of mmc request in work queues handler

The mmc request should assigned before use. Then
It should avoid freeing before using in mmc_request_done().
Signed-off-by: default avatarPhong Tran <tranmanphong@gmail.com>
Reviewed-by: default avatarRui Miguel Silva <rui.silva@linaro.org>
Reviewed-by: default avatarMark Greer <mgreer@animalcreek.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 9b86bdf9
......@@ -387,13 +387,18 @@ static void gb_sdio_mrq_work(struct work_struct *work)
host = container_of(work, struct gb_sdio_host, mrqwork);
mutex_lock(&host->lock);
mrq = host->mrq;
if (!mrq) {
mutex_unlock(&host->lock);
dev_err(mmc_dev(host->mmc), "mmc request is NULL");
return;
}
if (host->removed) {
mrq->cmd->error = -ESHUTDOWN;
goto done;
}
mrq = host->mrq;
if (mrq->sbc) {
ret = gb_sdio_command(host, mrq->sbc);
if (ret < 0)
......@@ -417,7 +422,7 @@ static void gb_sdio_mrq_work(struct work_struct *work)
}
done:
mrq = NULL;
host->mrq = NULL;
mutex_unlock(&host->lock);
mmc_request_done(host->mmc, mrq);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment