Skip to content

Commit 3446861

Browse files
huangshaoqinmstsirkin
authored andcommitted
virtio_pci: 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: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Xuan Zhuo <[email protected]>
1 parent 38fc462 commit 3446861

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/virtio/virtio_pci_modern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
310310
if (!num || vp_modern_get_queue_enable(mdev, index))
311311
return ERR_PTR(-ENOENT);
312312

313-
if (num & (num - 1)) {
313+
if (!is_power_of_2(num)) {
314314
dev_warn(&vp_dev->pci_dev->dev, "bad queue size %u", num);
315315
return ERR_PTR(-EINVAL);
316316
}

0 commit comments

Comments
 (0)