diff options
-rw-r--r-- | drivers/infiniband/core/cma.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 845090b0859c..4975d8154a78 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -1481,19 +1481,18 @@ static int cma_bind_loopback(struct rdma_id_private *id_priv) | |||
1481 | u8 p; | 1481 | u8 p; |
1482 | 1482 | ||
1483 | mutex_lock(&lock); | 1483 | mutex_lock(&lock); |
1484 | if (list_empty(&dev_list)) { | ||
1485 | ret = -ENODEV; | ||
1486 | goto out; | ||
1487 | } | ||
1484 | list_for_each_entry(cma_dev, &dev_list, list) | 1488 | list_for_each_entry(cma_dev, &dev_list, list) |
1485 | for (p = 1; p <= cma_dev->device->phys_port_cnt; ++p) | 1489 | for (p = 1; p <= cma_dev->device->phys_port_cnt; ++p) |
1486 | if (!ib_query_port (cma_dev->device, p, &port_attr) && | 1490 | if (!ib_query_port(cma_dev->device, p, &port_attr) && |
1487 | port_attr.state == IB_PORT_ACTIVE) | 1491 | port_attr.state == IB_PORT_ACTIVE) |
1488 | goto port_found; | 1492 | goto port_found; |
1489 | 1493 | ||
1490 | if (!list_empty(&dev_list)) { | 1494 | p = 1; |
1491 | p = 1; | 1495 | cma_dev = list_entry(dev_list.next, struct cma_device, list); |
1492 | cma_dev = list_entry(dev_list.next, struct cma_device, list); | ||
1493 | } else { | ||
1494 | ret = -ENODEV; | ||
1495 | goto out; | ||
1496 | } | ||
1497 | 1496 | ||
1498 | port_found: | 1497 | port_found: |
1499 | ret = ib_get_cached_gid(cma_dev->device, p, 0, &gid); | 1498 | ret = ib_get_cached_gid(cma_dev->device, p, 0, &gid); |