From 00229f96af9e3a01d6b7d5bd1e6dd41a559a77eb Mon Sep 17 00:00:00 2001 From: Vijay Viswanath Date: Thu, 27 Apr 2017 15:09:45 +0530 Subject: [PATCH] mmc: cmdq_hci: Avoid releasing clock twice during DCMD error When erase DCMD commands fail, a completion notification may get raised by host controller for the task in addition to error interrupt. This can result in the done function of mmc request getting called twice and release the clock twice and mess up the clock request counter. The done function should be called only once for DCMD commands except flush commands. Change-Id: Ie3a96e48ca98872cf686049eb5caa060f143f9cb Signed-off-by: Vijay Viswanath --- drivers/mmc/host/cmdq_hci.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/cmdq_hci.c b/drivers/mmc/host/cmdq_hci.c index a83960fd474f..3f741f83a436 100644 --- a/drivers/mmc/host/cmdq_hci.c +++ b/drivers/mmc/host/cmdq_hci.c @@ -1102,12 +1102,17 @@ skip_cqterri: * before setting doorbell, hence one is not needed here. */ for_each_set_bit(tag, &comp_status, cq_host->num_slots) { - /* complete the corresponding mrq */ - pr_debug("%s: completing tag -> %lu\n", - mmc_hostname(mmc), tag); - MMC_TRACE(mmc, "%s: completing tag -> %lu\n", - __func__, tag); + mrq = get_req_by_tag(cq_host, tag); + if (!((mrq->cmd && mrq->cmd->error) || + mrq->cmdq_req->resp_err || + (mrq->data && mrq->data->error))) { + /* complete the corresponding mrq */ + pr_debug("%s: completing tag -> %lu\n", + mmc_hostname(mmc), tag); + MMC_TRACE(mmc, "%s: completing tag -> %lu\n", + __func__, tag); cmdq_finish_data(mmc, tag); + } } }