summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx4/cm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/mlx4/cm.c')
-rw-r--r--drivers/infiniband/hw/mlx4/cm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mlx4/cm.c b/drivers/infiniband/hw/mlx4/cm.c
index 80e59ed864b3..e0d79b2395e4 100644
--- a/drivers/infiniband/hw/mlx4/cm.c
+++ b/drivers/infiniband/hw/mlx4/cm.c
@@ -225,7 +225,7 @@ id_map_alloc(struct ib_device *ibdev, int slave_id, u32 sl_cm_id)
ret = idr_alloc(&sriov->pv_id_table, ent, next_id, 0, GFP_NOWAIT);
if (ret >= 0) {
- next_id = ((unsigned)ret + 1) & MAX_IDR_MASK;
+ next_id = max(ret + 1, 0);
ent->pv_cm_id = (u32)ret;
sl_id_map_add(ibdev, ent);
list_add_tail(&ent->list, &sriov->cm_list);