summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGal Pressman <galpress@amazon.com>2019-02-06 16:45:35 +0300
committerJason Gunthorpe <jgg@mellanox.com>2019-02-07 23:14:55 +0300
commitaf8b38ed0b9d34db940a52418e7849904336ace5 (patch)
tree9b2a0b3457e7ddeba776254583ee1970862ba468
parent1a7a05e88fa0e4e168f83585d1bb1937197a9745 (diff)
downloadlinux-af8b38ed0b9d34db940a52418e7849904336ace5.tar.xz
IB/mlx5: Simplify WQE count power of two check
Use is_power_of_2() instead of hard coding it in the driver. While at it, fix the meaningless error print. Signed-off-by: Gal Pressman <galpress@amazon.com> Acked-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r--drivers/infiniband/hw/mlx5/qp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 664d5c6e72e4..4f2bc101b061 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -533,9 +533,9 @@ static int set_user_buf_size(struct mlx5_ib_dev *dev,
return -EINVAL;
}
- if (ucmd->sq_wqe_count && ((1 << ilog2(ucmd->sq_wqe_count)) != ucmd->sq_wqe_count)) {
- mlx5_ib_warn(dev, "sq_wqe_count %d, sq_wqe_count %d\n",
- ucmd->sq_wqe_count, ucmd->sq_wqe_count);
+ if (ucmd->sq_wqe_count && !is_power_of_2(ucmd->sq_wqe_count)) {
+ mlx5_ib_warn(dev, "sq_wqe_count %d is not a power of two\n",
+ ucmd->sq_wqe_count);
return -EINVAL;
}