Skip to content

Commit

Permalink
vhost-user: add get_vhost_net() assertions
Browse files Browse the repository at this point in the history
Add a few assertions to be more explicit about the runtime behaviour
after the previous patch: get_vhost_net() is non-null after
net_vhost_user_init().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
elmarco authored and mstsirkin committed Jul 28, 2016
1 parent e6bcb1b commit 1a5b68c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions hw/net/vhost_net.c
Expand Up @@ -417,6 +417,7 @@ VHostNetState *get_vhost_net(NetClientState *nc)
break;
case NET_CLIENT_DRIVER_VHOST_USER:
vhost_net = vhost_user_get_vhost_net(nc);
assert(vhost_net);
break;
default:
break;
Expand Down
2 changes: 2 additions & 0 deletions net/vhost-user.c
Expand Up @@ -259,6 +259,8 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,

qemu_chr_add_handlers(chr, NULL, NULL, net_vhost_user_event, nc[0].name);

assert(s->vhost_net);

return 0;
}

Expand Down

0 comments on commit 1a5b68c

Please sign in to comment.