From: "Michael S. Tsirkin" <mst@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
qemu-trivial@nongnu.org
Subject: Re: [PATCH] hw/virtio/vhost: Silence compiler warnings in vhost code when using -Wshadow
Date: Wed, 4 Oct 2023 08:51:40 -0400 [thread overview]
Message-ID: <20231004085134-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20231004114809.105672-1-thuth@redhat.com>
On Wed, Oct 04, 2023 at 01:48:09PM +0200, Thomas Huth wrote:
> Rename a variable in vhost_dev_sync_region() and remove a superfluous
> declaration in vhost_commit() to make this code compilable with "-Wshadow".
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> hw/virtio/vhost.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index e2f6ffb446..9cfac40fde 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -66,12 +66,12 @@ static void vhost_dev_sync_region(struct vhost_dev *dev,
> uint64_t mfirst, uint64_t mlast,
> uint64_t rfirst, uint64_t rlast)
> {
> - vhost_log_chunk_t *log = dev->log->log;
> + vhost_log_chunk_t *dev_log = dev->log->log;
>
> uint64_t start = MAX(mfirst, rfirst);
> uint64_t end = MIN(mlast, rlast);
> - vhost_log_chunk_t *from = log + start / VHOST_LOG_CHUNK;
> - vhost_log_chunk_t *to = log + end / VHOST_LOG_CHUNK + 1;
> + vhost_log_chunk_t *from = dev_log + start / VHOST_LOG_CHUNK;
> + vhost_log_chunk_t *to = dev_log + end / VHOST_LOG_CHUNK + 1;
> uint64_t addr = QEMU_ALIGN_DOWN(start, VHOST_LOG_CHUNK);
>
> if (end < start) {
> @@ -549,7 +549,7 @@ static void vhost_commit(MemoryListener *listener)
> changed = true;
> } else {
> /* Same size, lets check the contents */
> - for (int i = 0; i < n_old_sections; i++) {
> + for (i = 0; i < n_old_sections; i++) {
> if (!MemoryRegionSection_eq(&old_sections[i],
> &dev->mem_sections[i])) {
> changed = true;
> --
> 2.41.0
next prev parent reply other threads:[~2023-10-04 12:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-04 11:48 [PATCH] hw/virtio/vhost: Silence compiler warnings in vhost code when using -Wshadow Thomas Huth
2023-10-04 12:51 ` Michael S. Tsirkin [this message]
2023-10-06 6:26 ` Michael Tokarev
2023-10-06 8:55 ` Markus Armbruster
2023-10-06 10:45 ` Michael Tokarev
2023-10-06 10:51 ` Markus Armbruster
2023-10-06 11:24 ` Michael S. Tsirkin
2023-10-06 11:38 ` Markus Armbruster
2023-10-07 9:28 ` Michael Tokarev
2023-10-09 6:02 ` Markus Armbruster
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=20231004085134-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=thuth@redhat.com \
/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).