[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1360708860-23466-4-git-send-email-linus.walleij@linaro.org>
Date: Tue, 12 Feb 2013 23:40:53 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Jens Axboe <axboe@...nel.dk>
Cc: linux-kernel@...r.kernel.org,
Linus Walleij <linus.walleij@...aro.org>
Subject: [PATCH 2/9] block: xd: fix up request handler loop
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@...aro.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists