list_for_each_entry(device, &ig.device_list, ig_list)
/* find if there's a match using the node GUID */
if (device->ib_device->node_guid == cma_id->device->node_guid)
- goto out;
+ goto inc_refcnt;
device = kzalloc(sizeof *device, GFP_KERNEL);
if (device == NULL)
}
list_add(&device->ig_list, &ig.device_list);
-out:
- BUG_ON(device == NULL);
+inc_refcnt:
device->refcount++;
+out:
mutex_unlock(&ig.device_list_mutex);
return device;
}
int ret;
device = iser_device_find_by_ib_device(cma_id);
+ if (!device) {
+ iser_err("device lookup/creation failed\n");
+ iser_connect_error(cma_id);
+ return;
+ }
+
ib_conn = (struct iser_conn *)cma_id->context;
ib_conn->device = device;
iser_err("resolve route failed: %d\n", ret);
iser_connect_error(cma_id);
}
- return;
}
static void iser_route_handler(struct rdma_cm_id *cma_id)