net/vhost: check creation failure
authorYunjian Wang <wangyunjian@huawei.com>
Tue, 7 Jan 2020 03:25:48 +0000 (11:25 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 17 Jan 2020 18:46:02 +0000 (19:46 +0100)
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 <wangyunjian@huawei.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
drivers/net/vhost/rte_eth_vhost.c

index 46f01a7..a635889 100644 (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);