projects
/
linux-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0a9d74d
)
vhost-vdpa: refine ioctl pre-processing
author
Jason Wang
<jasowang@redhat.com>
Tue, 4 Aug 2020 16:20:37 +0000
(19:20 +0300)
committer
Michael S. Tsirkin
<mst@redhat.com>
Wed, 5 Aug 2020 22:39:17 +0000
(18:39 -0400)
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>
drivers/vhost/vdpa.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/vhost/vdpa.c
b/drivers/vhost/vdpa.c
index f8f8c9cf05b01058d6b161b6ec81cbe23beee09e..01475bec6e0dedddb5ff422953e68340f4d89501 100644
(file)
--- 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)