diff options
author | Shaoqin Huang <shaoqin.huang@intel.com> | 2022-10-21 09:27:34 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2022-12-28 13:28:09 +0300 |
commit | b9d978a89296c57fbbbd8ea647c303ce4d37028f (patch) | |
tree | 8c65295579a9c92e5d5e816b4c9a56ef468aed69 | |
parent | 344686136d73501a18a9621de690ff7824a3d129 (diff) | |
download | linux-b9d978a89296c57fbbbd8ea647c303ce4d37028f.tar.xz |
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 <shaoqin.huang@intel.com>
Message-Id: <20221021062734.228881-3-shaoqin.huang@intel.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
-rw-r--r-- | drivers/virtio/virtio_ring.c | 2 |
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; } |