virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org,
	Jiapeng Zhong <abaci-bugfix@linux.alibaba.com>
Subject: Re: [PATCH] virtio_ring: boolean values to a bool variable
Date: Mon, 3 May 2021 04:17:23 -0400	[thread overview]
Message-ID: <20210503041706-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1d311c25-9051-ddcd-e7e1-5adbb8a913f9@redhat.com>

On Mon, Jan 18, 2021 at 10:57:03AM +0800, Jason Wang wrote:
> 
> 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@linux.alibaba.com>
> > Signed-off-by: Jiapeng Zhong <abaci-bugfix@linux.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


Agreed if we are doing this let's change them all.

> 
> > ---
> >   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;

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

      reply	other threads:[~2021-05-03  8:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1610704825-17724-1-git-send-email-abaci-bugfix@linux.alibaba.com>
2021-01-18  2:57 ` [PATCH] virtio_ring: boolean values to a bool variable Jason Wang
2021-05-03  8:17   ` Michael S. Tsirkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210503041706-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=abaci-bugfix@linux.alibaba.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).