summaryrefslogtreecommitdiff
path: root/drivers/vhost
diff options
context:
space:
mode:
authorEli Cohen <eli@mellanox.com>2020-08-04 19:20:44 +0300
committerMichael S. Tsirkin <mst@redhat.com>2020-08-06 02:00:23 +0300
commit23750e39d57433d0e3d89658f0bc448f9c42ff49 (patch)
tree9f377ffa73d12ea6d7b8c8a9196f5250e923eb2b /drivers/vhost
parentaac50c0bd434794b9950181349099e709ca4edad (diff)
downloadlinux-23750e39d57433d0e3d89658f0bc448f9c42ff49.tar.xz
vdpa: Modify get_vq_state() to return error code
Modify get_vq_state() so it returns an error code. In case of hardware acceleration, the available index may be retrieved from the device, an operation that can possibly fail. Reviewed-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Eli Cohen <eli@mellanox.com> Link: https://lore.kernel.org/r/20200804162048.22587-9-eli@mellanox.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/vdpa.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 066b165c17b1..3fab94f88894 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -375,7 +375,10 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
ops->set_vq_ready(vdpa, idx, s.num);
return 0;
case VHOST_GET_VRING_BASE:
- ops->get_vq_state(v->vdpa, idx, &vq_state);
+ r = ops->get_vq_state(v->vdpa, idx, &vq_state);
+ if (r)
+ return r;
+
vq->last_avail_idx = vq_state.avail_index;
break;
case VHOST_GET_BACKEND_FEATURES: