Messages in this thread Patch in this message | | | From | Linus Walleij <> | Subject | [PATCH 2/9] block: xd: fix up request handler loop | Date | Tue, 12 Feb 2013 23:40:53 +0100 |
| |
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
| |