vhost-user: add get_vhost_net() assertions
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>
This commit is contained in:
parent
e6bcb1b617
commit
1a5b68cee8
@ -417,6 +417,7 @@ VHostNetState *get_vhost_net(NetClientState *nc)
|
|||||||
break;
|
break;
|
||||||
case NET_CLIENT_DRIVER_VHOST_USER:
|
case NET_CLIENT_DRIVER_VHOST_USER:
|
||||||
vhost_net = vhost_user_get_vhost_net(nc);
|
vhost_net = vhost_user_get_vhost_net(nc);
|
||||||
|
assert(vhost_net);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -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);
|
qemu_chr_add_handlers(chr, NULL, NULL, net_vhost_user_event, nc[0].name);
|
||||||
|
|
||||||
|
assert(s->vhost_net);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user