Skip to content

Commit a97ef87

Browse files
jasowangmstsirkin
authored andcommitted
vhost-vdpa: tweak the error label in vhost_vdpa_add()
Introduce new error label to avoid the unnecessary checking of net pointer. Fixes: 1e0a84e ("vhost-vdpa: introduce vhost-vdpa net client") Signed-off-by: Jason Wang <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent ab36edc commit a97ef87

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

net/vhost-vdpa.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,18 @@ static int vhost_vdpa_add(NetClientState *ncs, void *be)
9999
net = vhost_net_init(&options);
100100
if (!net) {
101101
error_report("failed to init vhost_net for queue");
102-
goto err;
102+
goto err_init;
103103
}
104104
s->vhost_net = net;
105105
ret = vhost_vdpa_net_check_device_id(net);
106106
if (ret) {
107-
goto err;
107+
goto err_check;
108108
}
109109
return 0;
110-
err:
111-
if (net) {
112-
vhost_net_cleanup(net);
113-
g_free(net);
114-
}
110+
err_check:
111+
vhost_net_cleanup(net);
112+
g_free(net);
113+
err_init:
115114
return -1;
116115
}
117116

0 commit comments

Comments
 (0)