Commit 5f997fd1 authored by Michal Privoznik's avatar Michal Privoznik Committed by Jason Wang
Browse files

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: default avatarMichal Privoznik <mprivozn@redhat.com>
Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
parent 2484ff06
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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,