All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org,  Juan Quintela <quintela@redhat.com>,
	 Peter Xu <peterx@redhat.com>,  Fabiano Rosas <farosas@suse.de>,
	 Leonardo Bras <leobras@redhat.com>
Subject: Re: [PATCH v2] migration/ram: Fix compilation with -Wshadow=local
Date: Tue, 24 Oct 2023 12:34:54 +0200	[thread overview]
Message-ID: <87a5s8s3zl.fsf@pond.sub.org> (raw)
In-Reply-To: <20231024092220.55305-1-thuth@redhat.com> (Thomas Huth's message of "Tue, 24 Oct 2023 11:22:20 +0200")

Thomas Huth <thuth@redhat.com> writes:

> Rename the variable here to avoid that it shadows a variable from
> the beginning of the function scope. With this change the code now
> successfully compiles with -Wshadow=local.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  v2: Need the value for the qemu_file_set_error() line, too
>
>  migration/ram.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/migration/ram.c b/migration/ram.c
> index 92769902bb..212add4481 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -3208,6 +3208,8 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
>      rs->last_stage = !migration_in_colo_state();
>  
>      WITH_RCU_READ_LOCK_GUARD() {
> +        int rdma_reg_ret;
> +
>          if (!migration_in_postcopy()) {
>              migration_bitmap_sync_precopy(rs, true);
>          }
> @@ -3238,9 +3240,9 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
>  
>          ram_flush_compressed_data(rs);
>  
> -        int ret = rdma_registration_stop(f, RAM_CONTROL_FINISH);
> -        if (ret < 0) {
> -            qemu_file_set_error(f, ret);
> +        rdma_reg_ret = rdma_registration_stop(f, RAM_CONTROL_FINISH);
> +        if (rdma_reg_ret < 0) {
> +            qemu_file_set_error(f, rdma_reg_ret);
>          }
>      }

Still ugly, but we want a minimally invasive fix now, and this is one.

Reviewed-by: Markus Armbruster <armbru@redhat.com>

and queued.  Thanks!



      parent reply	other threads:[~2023-10-24 10:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24  9:22 [PATCH v2] migration/ram: Fix compilation with -Wshadow=local Thomas Huth
2023-10-24 10:32 ` Juan Quintela
2023-10-24 10:57   ` Markus Armbruster
2023-10-24 10:34 ` Markus Armbruster [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=87a5s8s3zl.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=farosas@suse.de \
    --cc=leobras@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --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 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.