mirror of
https://github.com/torvalds/linux.git
synced 2026-05-22 14:12:07 +02:00
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 <shaoqin.huang@intel.com> Message-Id: <20221021062734.228881-2-shaoqin.huang@intel.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
This commit is contained in:
parent
38fc462f57
commit
344686136d
|
|
@ -310,7 +310,7 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
|
|||
if (!num || vp_modern_get_queue_enable(mdev, index))
|
||||
return ERR_PTR(-ENOENT);
|
||||
|
||||
if (num & (num - 1)) {
|
||||
if (!is_power_of_2(num)) {
|
||||
dev_warn(&vp_dev->pci_dev->dev, "bad queue size %u", num);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user