[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1d311c25-9051-ddcd-e7e1-5adbb8a913f9@redhat.com>
Date: Mon, 18 Jan 2021 10:57:03 +0800
From: Jason Wang <jasowang@...hat.com>
To: Jiapeng Zhong <abaci-bugfix@...ux.alibaba.com>, mst@...hat.com
Cc: virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] virtio_ring: boolean values to a bool variable
On 2021/1/15 下午6:00, Jiapeng Zhong wrote:
> Fix the following coccicheck warnings:
>
> ./drivers/virtio/virtio_ring.c:1637:1-29: WARNING: Assignment of
> 0/1 to bool variable.
>
> ./drivers/virtio/virtio_ring.c:1636:1-30: WARNING: Assignment of
> 0/1 to bool variable.
>
> Reported-by: Abaci Robot <abaci@...ux.alibaba.com>
> Signed-off-by: Jiapeng Zhong <abaci-bugfix@...ux.alibaba.com>
It looks to me it's not the only places:
git grep avail_wrap_counter
drivers/virtio/virtio_ring.c: bool avail_wrap_counter;
drivers/virtio/virtio_ring.c: vq->packed.avail_wrap_counter ^= 1;
drivers/virtio/virtio_ring.c: vq->packed.avail_wrap_counter ^= 1;
drivers/virtio/virtio_ring.c: if (wrap_counter !=
vq->packed.avail_wrap_counter)
drivers/virtio/virtio_ring.c: vq->packed.avail_wrap_counter = 1;
Thanks
> ---
> drivers/virtio/virtio_ring.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 71e16b5..5adb361 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -1633,8 +1633,8 @@ static struct virtqueue *vring_create_virtqueue_packed(
> vq->packed.vring.device = device;
>
> vq->packed.next_avail_idx = 0;
> - vq->packed.avail_wrap_counter = 1;
> - vq->packed.used_wrap_counter = 1;
> + vq->packed.avail_wrap_counter = true;
> + vq->packed.used_wrap_counter = true;
> vq->packed.event_flags_shadow = 0;
> vq->packed.avail_used_flags = 1 << VRING_PACKED_DESC_F_AVAIL;
>
Powered by blists - more mailing lists