net/vhost: check creation failure

The function eth_dev_vhost_create() could return errors,
the return value need to be checked.

Fixes: ee584e9710 ("vhost: add driver on top of the library")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
This commit is contained in:
Yunjian Wang 2020-01-07 11:25:48 +08:00 committed by Ferruh Yigit
parent 74f45f872c
commit f04513bc89

View File

@ -1302,7 +1302,7 @@ eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name,
}
rte_eth_dev_probing_finish(eth_dev);
return data->port_id;
return 0;
error:
if (internal) {
@ -1455,8 +1455,10 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev)
if (dev->device.numa_node == SOCKET_ID_ANY)
dev->device.numa_node = rte_socket_id();
eth_dev_vhost_create(dev, iface_name, queues, dev->device.numa_node,
flags, disable_flags);
ret = eth_dev_vhost_create(dev, iface_name, queues,
dev->device.numa_node, flags, disable_flags);
if (ret == -1)
VHOST_LOG(ERR, "Failed to create %s\n", name);
out_free:
rte_kvargs_free(kvlist);