Merge "mmc: core: Return the error if command queue request fails"

This commit is contained in:
Linux Build Service Account 2017-11-27 04:36:17 -08:00 committed by Gerrit - the friendly Code Review server
commit a8c0403aeb
2 changed files with 37 additions and 10 deletions

View file

@ -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);

View file

@ -805,7 +805,7 @@ static int cmdq_request(struct mmc_host *mmc, struct mmc_request *mrq)
if (err) {
pr_err("%s: failed to configure crypto: err %d tag %d\n",
mmc_hostname(mmc), err, tag);
goto out;
goto ice_err;
}
}
@ -823,7 +823,7 @@ static int cmdq_request(struct mmc_host *mmc, struct mmc_request *mrq)
if (err) {
pr_err("%s: %s: failed to setup tx desc: %d\n",
mmc_hostname(mmc), __func__, err);
goto out;
goto desc_err;
}
cq_host->mrq_slot[tag] = mrq;
@ -843,6 +843,22 @@ ring_doorbell:
/* Commit the doorbell write immediately */
wmb();
return err;
desc_err:
if (cq_host->ops->crypto_cfg_end) {
err = cq_host->ops->crypto_cfg_end(mmc, mrq);
if (err) {
pr_err("%s: failed to end ice config: err %d tag %d\n",
mmc_hostname(mmc), err, tag);
}
}
if (!(cq_host->caps & CMDQ_CAP_CRYPTO_SUPPORT) &&
cq_host->ops->crypto_cfg_reset)
cq_host->ops->crypto_cfg_reset(mmc, tag);
ice_err:
if (err)
cmdq_runtime_pm_put(cq_host);
out:
return err;
}