diff options
author | Phong Tran <tranmanphong@gmail.com> | 2015-06-26 21:05:13 +0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-06-29 18:06:08 -0700 |
commit | 93a99e8a105aeaec432995196c21ffedcd0c0cad (patch) | |
tree | 28195c68e6d23847316fadf4e9bb5ca39ce40cb3 /drivers/staging/greybus/sdio.c | |
parent | 9b86bdf96ef79e5e286628cb2e3ea6639db71904 (diff) | |
download | linux-93a99e8a105aeaec432995196c21ffedcd0c0cad.tar.bz2 |
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>
Diffstat (limited to 'drivers/staging/greybus/sdio.c')
-rw-r--r-- | drivers/staging/greybus/sdio.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/staging/greybus/sdio.c b/drivers/staging/greybus/sdio.c index cf12592d3468..30ebd42da287 100644 --- a/drivers/staging/greybus/sdio.c +++ b/drivers/staging/greybus/sdio.c @@ -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); } |