diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index dcefe1fceb5c..61588bd273bd 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -543,14 +543,21 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
543 | { | 543 | { |
544 | static int mlx4_ib_version_printed; | 544 | static int mlx4_ib_version_printed; |
545 | struct mlx4_ib_dev *ibdev; | 545 | struct mlx4_ib_dev *ibdev; |
546 | int num_ports = 0; | ||
546 | int i; | 547 | int i; |
547 | 548 | ||
548 | |||
549 | if (!mlx4_ib_version_printed) { | 549 | if (!mlx4_ib_version_printed) { |
550 | printk(KERN_INFO "%s", mlx4_ib_version); | 550 | printk(KERN_INFO "%s", mlx4_ib_version); |
551 | ++mlx4_ib_version_printed; | 551 | ++mlx4_ib_version_printed; |
552 | } | 552 | } |
553 | 553 | ||
554 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) | ||
555 | num_ports++; | ||
556 | |||
557 | /* No point in registering a device with no ports... */ | ||
558 | if (num_ports == 0) | ||
559 | return NULL; | ||
560 | |||
554 | ibdev = (struct mlx4_ib_dev *) ib_alloc_device(sizeof *ibdev); | 561 | ibdev = (struct mlx4_ib_dev *) ib_alloc_device(sizeof *ibdev); |
555 | if (!ibdev) { | 562 | if (!ibdev) { |
556 | dev_err(&dev->pdev->dev, "Device struct alloc failed\n"); | 563 | dev_err(&dev->pdev->dev, "Device struct alloc failed\n"); |
@@ -574,9 +581,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
574 | ibdev->ib_dev.owner = THIS_MODULE; | 581 | ibdev->ib_dev.owner = THIS_MODULE; |
575 | ibdev->ib_dev.node_type = RDMA_NODE_IB_CA; | 582 | ibdev->ib_dev.node_type = RDMA_NODE_IB_CA; |
576 | ibdev->ib_dev.local_dma_lkey = dev->caps.reserved_lkey; | 583 | ibdev->ib_dev.local_dma_lkey = dev->caps.reserved_lkey; |
577 | ibdev->num_ports = 0; | 584 | ibdev->num_ports = num_ports; |
578 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) | ||
579 | ibdev->num_ports++; | ||
580 | ibdev->ib_dev.phys_port_cnt = ibdev->num_ports; | 585 | ibdev->ib_dev.phys_port_cnt = ibdev->num_ports; |
581 | ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors; | 586 | ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors; |
582 | ibdev->ib_dev.dma_device = &dev->pdev->dev; | 587 | ibdev->ib_dev.dma_device = &dev->pdev->dev; |