OSDN Git Service

mmc: cmdq_hci: Avoid releasing clock twice during DCMD error
authorVijay Viswanath <vviswana@codeaurora.org>
Thu, 27 Apr 2017 09:39:45 +0000 (15:09 +0530)
committerGerrit - the friendly Code Review server <code-review@localhost>
Mon, 1 May 2017 09:05:53 +0000 (02:05 -0700)
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 <vviswana@codeaurora.org>
drivers/mmc/host/cmdq_hci.c

index a83960f..3f741f8 100644 (file)
@@ -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);
+                       }
                }
        }