@@ -556,21 +556,20 @@ struct mmc_async_req *mmc_start_req(struct mmc_host *host,
mmc_start_bkops(host->card, true);
}
- if (!saved_err && areq)
+ /* Don't start something new if previous one failed. */
+ if (!saved_err && areq) {
start_err = __mmc_start_data_req(host, areq->mrq);
+ /* Cancel a prepared request if it was not started. */
+ if (start_err) {
+ mmc_post_req(host, areq->mrq, -EINVAL);
+ host->areq = NULL;
+ } else
+ host->areq = areq;
+ }
if (saved_areq)
mmc_post_req(host, saved_areq->mrq, 0);
- /* Cancel a prepared request if it was not started. */
- if ((saved_err || start_err) && areq)
- mmc_post_req(host, areq->mrq, -EINVAL);
-
- if (saved_err)
- host->areq = NULL;
- else
- host->areq = areq;
-
if (error)
*error = saved_err;
return saved_areq;
This is an intermediate step to fixing the locking around the access to host->areq. Reduce the number of "if (saved_areq) vs "if (areq)" tests in the main code path since I'm going to add references to "host->lock" in the next patch. Signed-off-by: Grant Grundler <grundler@chromium.org> --- drivers/mmc/core/core.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)