lkml.org 
[lkml]   [2013]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/7] mmc: core: restructure error handling for start req
Date
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(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 675139e..4d5de98 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -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;
--
1.8.4


\
 
 \ /
  Last update: 2013-09-26 21:41    [W:0.102 / U:0.688 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site