From the ibv_get_device_list man page:
ibv_get_device_list() returns the array of available RDMA devices, or
sets errno and returns NULL if the request fails. If no devices are
found then num_devices is set to 0, and non-NULL is returned.
The librdmacm handles the failure case, but not the case where no
devices are found. Handle that case as well.
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
goto err1;
}
+ if (!dev_cnt) {
+ printf("CMA: no RDMA devices found\n");
+ ret = ERR(ENODEV);
+ goto err2;
+ }
+
cma_dev_array = malloc(sizeof *cma_dev * dev_cnt);
if (!cma_dev_array) {
ret = ERR(ENOMEM);