From 33ab6ff829637d9267b36f484bcb4ccd29f2642b Mon Sep 17 00:00:00 2001 From: Asutosh Das Date: Tue, 22 Jul 2014 16:27:54 +0530 Subject: [PATCH] mmc: block: fix race in deferred resume The actual resume takes place when a request is received. In a situation when mmcqd and qseecomd(rpmb) both try to resume the device, a race is ensued. This is because mmcqd first resumes the device and then claims the host. Ideally, if resume is in progress in one context the resume in the other context should be cancelled. Claim the host before resuming the device in mmcqd context. CRs-fixed: 697018 Change-Id: I11d33e642a9b2022f77277196de128c9ac78d334 Signed-off-by: Asutosh Das --- drivers/mmc/card/block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index f6cadbfb776d..0635e75b7768 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -2772,12 +2772,12 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) if (req && !mq->mqrq_prev->req) { mmc_rpm_hold(host, &card->dev); + /* claim host only for the first request */ + mmc_claim_host(card->host); #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME if (mmc_bus_needs_resume(card->host)) mmc_resume_bus(card->host); #endif - /* claim host only for the first request */ - mmc_claim_host(card->host); if (card->ext_csd.bkops_en) mmc_stop_bkops(card); }