diff options
author | Eli Cohen <eli@dev.mellanox.co.il> | 2013-10-31 09:26:34 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2013-11-15 17:36:36 -0500 |
commit | 79d3da9c51a5fef672b329b8d8583a089d147bef (patch) | |
tree | 6d19ba728b69f7a49a008abac9c0081c97ff5402 /drivers/infiniband/hw | |
parent | 2b136d025348774633a2f6fc2a87f0cf409a3ab9 (diff) |
IB/mlx4: Fix device max capabilities check
Move the check on max supported CQEs after the final number of entries is
evaluated.
Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r-- | drivers/infiniband/hw/mlx4/cq.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index d5e60f44ba5a..ea299515ecb2 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c | |||
@@ -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) |