diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/core/cma.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index cfd57b4abd03..2eb52b7a71da 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -368,6 +368,11 @@ static void cma_enable_remove(struct rdma_id_private *id_priv) | |||
368 | wake_up(&id_priv->wait_remove); | 368 | wake_up(&id_priv->wait_remove); |
369 | } | 369 | } |
370 | 370 | ||
371 | static int cma_has_cm_dev(struct rdma_id_private *id_priv) | ||
372 | { | ||
373 | return (id_priv->id.device && id_priv->cm_id.ib); | ||
374 | } | ||
375 | |||
371 | struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler, | 376 | struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler, |
372 | void *context, enum rdma_port_space ps) | 377 | void *context, enum rdma_port_space ps) |
373 | { | 378 | { |
@@ -2422,7 +2427,7 @@ int rdma_notify(struct rdma_cm_id *id, enum ib_event_type event) | |||
2422 | int ret; | 2427 | int ret; |
2423 | 2428 | ||
2424 | id_priv = container_of(id, struct rdma_id_private, id); | 2429 | id_priv = container_of(id, struct rdma_id_private, id); |
2425 | if (!cma_comp(id_priv, CMA_CONNECT)) | 2430 | if (!cma_has_cm_dev(id_priv)) |
2426 | return -EINVAL; | 2431 | return -EINVAL; |
2427 | 2432 | ||
2428 | switch (id->device->node_type) { | 2433 | switch (id->device->node_type) { |
@@ -2444,7 +2449,7 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data, | |||
2444 | int ret; | 2449 | int ret; |
2445 | 2450 | ||
2446 | id_priv = container_of(id, struct rdma_id_private, id); | 2451 | id_priv = container_of(id, struct rdma_id_private, id); |
2447 | if (!cma_comp(id_priv, CMA_CONNECT)) | 2452 | if (!cma_has_cm_dev(id_priv)) |
2448 | return -EINVAL; | 2453 | return -EINVAL; |
2449 | 2454 | ||
2450 | switch (rdma_node_get_transport(id->device->node_type)) { | 2455 | switch (rdma_node_get_transport(id->device->node_type)) { |
@@ -2475,8 +2480,7 @@ int rdma_disconnect(struct rdma_cm_id *id) | |||
2475 | int ret; | 2480 | int ret; |
2476 | 2481 | ||
2477 | id_priv = container_of(id, struct rdma_id_private, id); | 2482 | id_priv = container_of(id, struct rdma_id_private, id); |
2478 | if (!cma_comp(id_priv, CMA_CONNECT) && | 2483 | if (!cma_has_cm_dev(id_priv)) |
2479 | !cma_comp(id_priv, CMA_DISCONNECT)) | ||
2480 | return -EINVAL; | 2484 | return -EINVAL; |
2481 | 2485 | ||
2482 | switch (rdma_node_get_transport(id->device->node_type)) { | 2486 | switch (rdma_node_get_transport(id->device->node_type)) { |