From: David Edmondson <david.edmondson@oracle.com>
To: Feng Liu <feliu@nvidia.com>, virtualization@lists.linux-foundation.org
Cc: Bodong Wang <bodong@nvidia.com>, Jiri Pirko <jiri@nvidia.com>,
Gavin Li <gavinl@nvidia.com>,
"Michael S . Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH 1/3] virtio_pci_modern: Remove unnecessary num zero check
Date: Tue, 07 Mar 2023 09:10:12 +0000 [thread overview]
Message-ID: <m2zg8pyljf.fsf@oracle.com> (raw)
In-Reply-To: <20230307035705.4479-2-feliu@nvidia.com>
Feng Liu via Virtualization <virtualization@lists.linux-foundation.org>
writes:
> is_power_of_2() already performs the zero check. Hence avoid duplicate
> check. While at it, move the query of size check also adjacent to where
> its used for the disabled vq.
>
> Signed-off-by: Feng Liu <feliu@nvidia.com>
> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> Reviewed-by: Parav Pandit <parav@nvidia.com>
> Reviewed-by: Gavin Li <gavinl@nvidia.com>
> Reviewed-by: Bodong Wang <bodong@nvidia.com>
Reviewed-by: David Edmondson <david.edmondson@oracle.com>
> ---
> drivers/virtio/virtio_pci_modern.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
> index 9e496e288cfa..3d7144f8f959 100644
> --- a/drivers/virtio/virtio_pci_modern.c
> +++ b/drivers/virtio/virtio_pci_modern.c
> @@ -306,10 +306,10 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
> return ERR_PTR(-EINVAL);
>
> /* Check if queue is either not available or already active. */
> - num = vp_modern_get_queue_size(mdev, index);
> - if (!num || vp_modern_get_queue_enable(mdev, index))
> + if (vp_modern_get_queue_enable(mdev, index))
> return ERR_PTR(-ENOENT);
>
> + num = vp_modern_get_queue_size(mdev, index);
> if (!is_power_of_2(num)) {
> dev_warn(&vp_dev->pci_dev->dev, "bad queue size %u", num);
> return ERR_PTR(-EINVAL);
> --
> 2.34.1
>
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization
--
It's funny, I spent my whole life wanting to be talked about.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2023-03-07 9:10 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 3:57 [PATCH 0/3] virtio_ring: Clean up code for virtio ring and pci Feng Liu via Virtualization
2023-03-07 3:57 ` [PATCH 1/3] virtio_pci_modern: Remove unnecessary num zero check Feng Liu via Virtualization
2023-03-07 9:10 ` David Edmondson [this message]
2023-03-08 5:52 ` Jason Wang
2023-03-08 6:57 ` Michael S. Tsirkin
2023-03-08 14:23 ` Michael S. Tsirkin
2023-03-08 14:33 ` Feng Liu via Virtualization
2023-03-07 3:57 ` [PATCH 2/3] virtio_ring: Avoid using inline for small functions Feng Liu via Virtualization
2023-03-07 9:11 ` David Edmondson
2023-03-08 5:55 ` Jason Wang
2023-03-07 3:57 ` [PATCH 3/3] virtio_ring: Use const to annotate read-only pointer params Feng Liu via Virtualization
2023-03-07 9:14 ` David Edmondson
2023-03-07 21:17 ` Feng Liu via Virtualization
2023-03-08 14:13 ` Michael S. Tsirkin
2023-03-08 15:59 ` Feng Liu via Virtualization
2023-03-08 16:25 ` Michael S. Tsirkin
2023-03-08 16:44 ` Feng Liu via Virtualization
2023-03-08 16:49 ` Michael S. Tsirkin
2023-03-08 17:26 ` Feng Liu via Virtualization
2023-03-08 5:58 ` Jason Wang
2023-03-08 14:07 ` Feng Liu via Virtualization
2023-03-08 14:13 ` Feng Liu via Virtualization
2023-03-08 14:16 ` Michael S. Tsirkin
2023-03-08 14:19 ` Feng Liu via Virtualization
2023-03-08 14:28 ` Michael S. Tsirkin
2023-03-08 14:40 ` Feng Liu via Virtualization
2023-03-08 14:47 ` Michael S. Tsirkin
2023-03-08 15:47 ` Feng Liu via Virtualization
[not found] ` <ZAmlwyVfz+IK1b6T@nanopsycho>
2023-03-09 14:27 ` Michael S. Tsirkin
2023-03-08 6:59 ` Michael S. Tsirkin
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=m2zg8pyljf.fsf@oracle.com \
--to=david.edmondson@oracle.com \
--cc=bodong@nvidia.com \
--cc=feliu@nvidia.com \
--cc=gavinl@nvidia.com \
--cc=jiri@nvidia.com \
--cc=mst@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.