qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] migration/ram: Fix compilation with -Wshadow=local


From: Markus Armbruster
Subject: Re: [PATCH v2] migration/ram: Fix compilation with -Wshadow=local
Date: Tue, 24 Oct 2023 12:34:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

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!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]