aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaoqin Huang <[email protected]>2022-10-20 23:27:34 -0700
committerMichael S. Tsirkin <[email protected]>2022-12-28 05:28:09 -0500
commitb9d978a89296c57fbbbd8ea647c303ce4d37028f (patch)
tree8c65295579a9c92e5d5e816b4c9a56ef468aed69
parent344686136d73501a18a9621de690ff7824a3d129 (diff)
virtio_ring: use helper function is_power_of_2()
Use helper function is_power_of_2() to check if num is power of two. Minor readability improvement. Signed-off-by: Shaoqin Huang <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Xuan Zhuo <[email protected]>
-rw-r--r--drivers/virtio/virtio_ring.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 2e7689bb933b..723c4e29e1d3 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -1052,7 +1052,7 @@ static int vring_alloc_queue_split(struct vring_virtqueue_split *vring_split,
dma_addr_t dma_addr;
/* We assume num is a power of 2. */
- if (num & (num - 1)) {
+ if (!is_power_of_2(num)) {
dev_warn(&vdev->dev, "Bad virtqueue length %u\n", num);
return -EINVAL;
}