From 48f0cccb8c234698a76f3af4241e76a0ef8f1eab Mon Sep 17 00:00:00 2001 From: Veerabhadrarao Badiganti Date: Mon, 9 Oct 2017 20:13:45 +0530 Subject: [PATCH] mmc: core: Return the error if command queue request fails command-queue request may fail during preparation/issuing in some cases. In case if it fails, the error code needs to be propagated back to the function which initiated the request so that the request can be handled appropriately. Change-Id: Ia6946c14f0c106fb30bd70ca5c9e600c516fdf55 Signed-off-by: Veerabhadrarao Badiganti --- drivers/mmc/core/core.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index cfd56d9fa2ca..8c6861564ed2 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1166,9 +1166,11 @@ static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) return 0; } -static void mmc_start_cmdq_request(struct mmc_host *host, +static int mmc_start_cmdq_request(struct mmc_host *host, struct mmc_request *mrq) { + int ret = 0; + if (mrq->data) { pr_debug("%s: blksz %d blocks %d flags %08x tsac %lu ms nsac %d\n", mmc_hostname(host), mrq->data->blksz, @@ -1190,11 +1192,21 @@ static void mmc_start_cmdq_request(struct mmc_host *host, } mmc_host_clk_hold(host); - if (likely(host->cmdq_ops->request)) - host->cmdq_ops->request(host, mrq); - else - pr_err("%s: %s: issue request failed\n", mmc_hostname(host), - __func__); + if (likely(host->cmdq_ops->request)) { + ret = host->cmdq_ops->request(host, mrq); + } else { + ret = -ENOENT; + pr_err("%s: %s: cmdq request host op is not available\n", + mmc_hostname(host), __func__); + } + + if (ret) { + mmc_host_clk_release(host); + pr_err("%s: %s: issue request failed, err=%d\n", + mmc_hostname(host), __func__, ret); + } + + return ret; } /** @@ -1681,8 +1693,7 @@ int mmc_cmdq_start_req(struct mmc_host *host, struct mmc_cmdq_req *cmdq_req) mrq->cmd->error = -ENOMEDIUM; return -ENOMEDIUM; } - mmc_start_cmdq_request(host, mrq); - return 0; + return mmc_start_cmdq_request(host, mrq); } EXPORT_SYMBOL(mmc_cmdq_start_req);