diff options
| -rw-r--r-- | drivers/infiniband/hw/mlx4/cq.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index a3b70f6c4035..cb63ecd2276f 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c | |||
| @@ -367,8 +367,7 @@ int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata) | |||
| 367 | int err; | 367 | int err; |
| 368 | 368 | ||
| 369 | mutex_lock(&cq->resize_mutex); | 369 | mutex_lock(&cq->resize_mutex); |
| 370 | 370 | if (entries < 1 || entries > dev->dev->caps.max_cqes) { | |
| 371 | if (entries < 1) { | ||
| 372 | err = -EINVAL; | 371 | err = -EINVAL; |
| 373 | goto out; | 372 | goto out; |
| 374 | } | 373 | } |
| @@ -379,7 +378,7 @@ int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata) | |||
| 379 | goto out; | 378 | goto out; |
| 380 | } | 379 | } |
| 381 | 380 | ||
| 382 | if (entries > dev->dev->caps.max_cqes) { | 381 | if (entries > dev->dev->caps.max_cqes + 1) { |
| 383 | err = -EINVAL; | 382 | err = -EINVAL; |
| 384 | goto out; | 383 | goto out; |
| 385 | } | 384 | } |
| @@ -392,7 +391,7 @@ int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata) | |||
| 392 | /* Can't be smaller than the number of outstanding CQEs */ | 391 | /* Can't be smaller than the number of outstanding CQEs */ |
| 393 | outst_cqe = mlx4_ib_get_outstanding_cqes(cq); | 392 | outst_cqe = mlx4_ib_get_outstanding_cqes(cq); |
| 394 | if (entries < outst_cqe + 1) { | 393 | if (entries < outst_cqe + 1) { |
| 395 | err = 0; | 394 | err = -EINVAL; |
| 396 | goto out; | 395 | goto out; |
| 397 | } | 396 | } |
| 398 | 397 | ||
