aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/vhost
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2020-08-04 19:20:37 +0300
committerMichael S. Tsirkin <mst@redhat.com>2020-08-05 18:39:17 -0400
commitb0bd82bf729dbd05757e599f20df38dff5b97091 (patch)
tree28f9aa110861756188f90af456763da69f42d69c /drivers/vhost
parentMerge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux into HEAD (diff)
downloadwireguard-linux-b0bd82bf729dbd05757e599f20df38dff5b97091.tar.xz
wireguard-linux-b0bd82bf729dbd05757e599f20df38dff5b97091.zip
vhost-vdpa: refine ioctl pre-processing
Switch to use 'switch' to make the codes more easier to be extended. Signed-off-by: Jason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/20200804162048.22587-2-eli@mellanox.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/vdpa.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index f8f8c9cf05b0..01475bec6e0d 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -360,15 +360,16 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
idx = array_index_nospec(idx, v->nvqs);
vq = &v->vqs[idx];
- if (cmd == VHOST_VDPA_SET_VRING_ENABLE) {
+ switch (cmd) {
+ case VHOST_VDPA_SET_VRING_ENABLE:
if (copy_from_user(&s, argp, sizeof(s)))
return -EFAULT;
ops->set_vq_ready(vdpa, idx, s.num);
return 0;
- }
-
- if (cmd == VHOST_GET_VRING_BASE)
+ case VHOST_GET_VRING_BASE:
vq->last_avail_idx = ops->get_vq_state(v->vdpa, idx);
+ break;
+ }
r = vhost_vring_ioctl(&v->vdev, cmd, argp);
if (r)