diff options
author | Michal Privoznik <mprivozn@redhat.com> | 2017-07-13 09:44:38 +0200 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2017-07-17 20:13:55 +0800 |
commit | 5f997fd17b9be6a662fa7b5cc1305076cd6c8894 (patch) | |
tree | 0bf2b2fd6571303bd2133bdca851c0762403d098 /hw | |
parent | 2484ff06249af64896885564b73af4f0750adfa2 (diff) | |
download | qemu-5f997fd17b9be6a662fa7b5cc1305076cd6c8894.zip |
virtion-net: Prefer is_power_of_2()
We have a function that checks if given number is power of two.
We should prefer it instead of expanding the check on our own.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/net/virtio-net.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 5630a9ec44..657d099c54 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1942,7 +1942,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) */ if (n->net_conf.rx_queue_size < VIRTIO_NET_RX_QUEUE_MIN_SIZE || n->net_conf.rx_queue_size > VIRTQUEUE_MAX_SIZE || - (n->net_conf.rx_queue_size & (n->net_conf.rx_queue_size - 1))) { + !is_power_of_2(n->net_conf.rx_queue_size)) { error_setg(errp, "Invalid rx_queue_size (= %" PRIu16 "), " "must be a power of 2 between %d and %d.", n->net_conf.rx_queue_size, VIRTIO_NET_RX_QUEUE_MIN_SIZE, |