lkml.org 
[lkml]   [2013]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/9] block: xd: fix up request handler loop
Date
The result (res) variable was set to -EIO in this loop, however
since the iteratively retried request execution loop would
exit on !res this means that loop is never taken.

Instead, assign zero to the res variable, and explicitly set
it to -EIO on error.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/block/xd.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/block/xd.c b/drivers/block/xd.c
index 303e9f2..ce088f8 100644
--- a/drivers/block/xd.c
+++ b/drivers/block/xd.c
@@ -322,13 +322,19 @@ static void do_xd_request (struct request_queue * q)
unsigned block = blk_rq_pos(req);
unsigned count = blk_rq_cur_sectors(req);
XD_INFO *disk = req->rq_disk->private_data;
- int res = -EIO;
+ int res = 0;
int retry;

- if (req->cmd_type != REQ_TYPE_FS)
+ if (req->cmd_type != REQ_TYPE_FS) {
+ pr_err("unsupported request: %d\n", req->cmd_type);
+ res = -EIO;
goto done;
- if (block + count > get_capacity(req->rq_disk))
+ }
+ if (block + count > get_capacity(req->rq_disk)) {
+ pr_err("request beyond device capacity\n");
+ res = -EIO;
goto done;
+ }
for (retry = 0; (retry < XD_RETRIES) && !res; retry++)
res = xd_readwrite(rq_data_dir(req), disk, req->buffer,
block, count);
--
1.8.1.2


\
 
 \ /
  Last update: 2013-02-13 00:21    [W:0.045 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site