mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-03 09:29:42 +00:00
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: Phong Tran <tranmanphong@gmail.com> Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org> Reviewed-by: Mark Greer <mgreer@animalcreek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
9b86bdf96e
commit
93a99e8a10
1 changed files with 8 additions and 3 deletions
|
@ -387,13 +387,18 @@ static void gb_sdio_mrq_work(struct work_struct *work)
|
||||||
host = container_of(work, struct gb_sdio_host, mrqwork);
|
host = container_of(work, struct gb_sdio_host, mrqwork);
|
||||||
|
|
||||||
mutex_lock(&host->lock);
|
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) {
|
if (host->removed) {
|
||||||
mrq->cmd->error = -ESHUTDOWN;
|
mrq->cmd->error = -ESHUTDOWN;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
mrq = host->mrq;
|
|
||||||
|
|
||||||
if (mrq->sbc) {
|
if (mrq->sbc) {
|
||||||
ret = gb_sdio_command(host, mrq->sbc);
|
ret = gb_sdio_command(host, mrq->sbc);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -417,7 +422,7 @@ static void gb_sdio_mrq_work(struct work_struct *work)
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
mrq = NULL;
|
host->mrq = NULL;
|
||||||
mutex_unlock(&host->lock);
|
mutex_unlock(&host->lock);
|
||||||
mmc_request_done(host->mmc, mrq);
|
mmc_request_done(host->mmc, mrq);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue