summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2010-03-04 22:10:14 +0100
committerMichael S. Tsirkin <mst@redhat.com>2010-05-27 11:25:37 +0200
commitdd1f4078f0d2de74a308f00a2dffbd550cfba59f (patch)
treed8a31277e7d37bc2fdda54abe0837bc829074c6f
parentvhost: Storage class should be before const qualifier (diff)
downloadlinux-dd1f4078f0d2de74a308f00a2dffbd550cfba59f.tar.xz
linux-dd1f4078f0d2de74a308f00a2dffbd550cfba59f.zip
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>
-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);