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>
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)
}
done:
- mrq = NULL;
+ host->mrq = NULL;
mutex_unlock(&host->lock);
mmc_request_done(host->mmc, mrq);
}