aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx4/cq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/mlx4/cq.c')
-rw-r--r--drivers/infiniband/hw/mlx4/cq.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index d5e60f44ba5a..66dbf8062374 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -324,7 +324,7 @@ static int mlx4_ib_get_outstanding_cqes(struct mlx4_ib_cq *cq)
324 u32 i; 324 u32 i;
325 325
326 i = cq->mcq.cons_index; 326 i = cq->mcq.cons_index;
327 while (get_sw_cqe(cq, i & cq->ibcq.cqe)) 327 while (get_sw_cqe(cq, i))
328 ++i; 328 ++i;
329 329
330 return i - cq->mcq.cons_index; 330 return i - cq->mcq.cons_index;
@@ -365,7 +365,7 @@ int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)
365 365
366 mutex_lock(&cq->resize_mutex); 366 mutex_lock(&cq->resize_mutex);
367 367
368 if (entries < 1 || entries > dev->dev->caps.max_cqes) { 368 if (entries < 1) {
369 err = -EINVAL; 369 err = -EINVAL;
370 goto out; 370 goto out;
371 } 371 }
@@ -376,6 +376,11 @@ int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)
376 goto out; 376 goto out;
377 } 377 }
378 378
379 if (entries > dev->dev->caps.max_cqes) {
380 err = -EINVAL;
381 goto out;
382 }
383
379 if (ibcq->uobject) { 384 if (ibcq->uobject) {
380 err = mlx4_alloc_resize_umem(dev, cq, entries, udata); 385 err = mlx4_alloc_resize_umem(dev, cq, entries, udata);
381 if (err) 386 if (err)