From: Yunjian Wang Date: Tue, 7 Jan 2020 03:25:48 +0000 (+0800) Subject: net/vhost: check creation failure X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f04513bc89d90c2ad425f1be1e4716bb3c790fb2;p=dpdk.git net/vhost: check creation failure The function eth_dev_vhost_create() could return errors, the return value need to be checked. Fixes: ee584e9710b9 ("vhost: add driver on top of the library") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang Reviewed-by: Tiwei Bie --- diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 46f01a7f46..a63588986f 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -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);