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 <[email protected]> --- 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

