Commit f0839372 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin

virtio_blk: correct types for status handling

virtblk_setup_cmd returns blk_status_t in an int, callers then assign it
back to a blk_status_t variable. blk_status_t is either u32 or (more
typically) u8 so it works, but is inelegant and causes sparse warnings.

Pass the status in blk_status_t in a consistent way.
Reported-by: default avatarkernel test robot <lkp@intel.com>
Fixes: b2c5221fd074 ("virtio-blk: avoid preallocating big SGL for data")
Cc: Max Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
parent ead65f76
...@@ -208,8 +208,9 @@ static void virtblk_cleanup_cmd(struct request *req) ...@@ -208,8 +208,9 @@ static void virtblk_cleanup_cmd(struct request *req)
kfree(bvec_virt(&req->special_vec)); kfree(bvec_virt(&req->special_vec));
} }
static int virtblk_setup_cmd(struct virtio_device *vdev, struct request *req, static blk_status_t virtblk_setup_cmd(struct virtio_device *vdev,
struct virtblk_req *vbr) struct request *req,
struct virtblk_req *vbr)
{ {
bool unmap = false; bool unmap = false;
u32 type; u32 type;
...@@ -317,14 +318,15 @@ static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx, ...@@ -317,14 +318,15 @@ static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx,
unsigned long flags; unsigned long flags;
unsigned int num; unsigned int num;
int qid = hctx->queue_num; int qid = hctx->queue_num;
int err;
bool notify = false; bool notify = false;
blk_status_t status;
int err;
BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems); BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems);
err = virtblk_setup_cmd(vblk->vdev, req, vbr); status = virtblk_setup_cmd(vblk->vdev, req, vbr);
if (unlikely(err)) if (unlikely(status))
return err; return status;
blk_mq_start_request(req); blk_mq_start_request(req);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment