Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 79d3da9c authored by Eli Cohen's avatar Eli Cohen Committed by Roland Dreier
Browse files

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: default avatarEli Cohen <eli@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent 2b136d02
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -365,7 +365,7 @@ int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)


	mutex_lock(&cq->resize_mutex);
	mutex_lock(&cq->resize_mutex);


	if (entries < 1 || entries > dev->dev->caps.max_cqes) {
	if (entries < 1) {
		err = -EINVAL;
		err = -EINVAL;
		goto out;
		goto out;
	}
	}
@@ -376,6 +376,11 @@ int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)
		goto out;
		goto out;
	}
	}


	if (entries > dev->dev->caps.max_cqes) {
		err = -EINVAL;
		goto out;
	}

	if (ibcq->uobject) {
	if (ibcq->uobject) {
		err = mlx4_alloc_resize_umem(dev, cq, entries, udata);
		err = mlx4_alloc_resize_umem(dev, cq, entries, udata);
		if (err)
		if (err)