summaryrefslogtreecommitdiffstats
path: root/drivers/vhost
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2010-03-04 16:10:14 -0500
committerMichael S. Tsirkin <mst@redhat.com>2010-05-27 12:25:37 +0300
commitdd1f4078f0d2de74a308f00a2dffbd550cfba59f (patch)
treed8a31277e7d37bc2fdda54abe0837bc829074c6f /drivers/vhost
parent373a83a6997bfdaf767f6a65fc5cc0054b246984 (diff)
downloadlinux-dd1f4078f0d2de74a308f00a2dffbd550cfba59f.tar.bz2
vhost-net: minor cleanup
Delete a label and goto from vhost_net_set_backend Inverting a test allows a label and goto to be eliminated. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/net.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index cd36f5ff2255..0868569d7124 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -519,13 +519,12 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
/* start polling new socket */
oldsock = vq->private_data;
- if (sock == oldsock)
- goto done;
+ if (sock != oldsock){
+ vhost_net_disable_vq(n, vq);
+ rcu_assign_pointer(vq->private_data, sock);
+ vhost_net_enable_vq(n, vq);
+ }
- vhost_net_disable_vq(n, vq);
- rcu_assign_pointer(vq->private_data, sock);
- vhost_net_enable_vq(n, vq);
-done:
if (oldsock) {
vhost_net_flush_vq(n, index);
fput(oldsock->file);