[PATCH] softmmu/vl: Remove redundant local variable

Zhenzhong Duan posted 1 patch 3 years, 11 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220228032710.184181-1-zhenzhong.duan@intel.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>
softmmu/vl.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH] softmmu/vl: Remove redundant local variable
Posted by Zhenzhong Duan 3 years, 11 months ago
While there is already a local variable opts in main function scope,
no need to define another one with same name in smaller scope.

No functional changes.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
 softmmu/vl.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/softmmu/vl.c b/softmmu/vl.c
index 1fe028800fdf..34b24512f8c5 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -3273,12 +3273,10 @@ void qemu_init(int argc, char **argv, char **envp)
                      exit(1);
                 }
                 break;
-            case QEMU_OPTION_watchdog_action: {
-                QemuOpts *opts;
+            case QEMU_OPTION_watchdog_action:
                 opts = qemu_opts_create(qemu_find_opts("action"), NULL, 0, &error_abort);
                 qemu_opt_set(opts, "watchdog", optarg, &error_abort);
                 break;
-            }
             case QEMU_OPTION_parallel:
                 add_device_config(DEV_PARALLEL, optarg);
                 default_parallel = 0;
-- 
2.25.1
Re: [PATCH] softmmu/vl: Remove redundant local variable
Posted by Philippe Mathieu-Daudé 3 years, 11 months ago
On 28/2/22 04:27, Zhenzhong Duan wrote:
> While there is already a local variable opts in main function scope,
> no need to define another one with same name in smaller scope.
> 
> No functional changes.
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
> ---
>   softmmu/vl.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index 1fe028800fdf..34b24512f8c5 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -3273,12 +3273,10 @@ void qemu_init(int argc, char **argv, char **envp)
>                        exit(1);
>                   }
>                   break;
> -            case QEMU_OPTION_watchdog_action: {
> -                QemuOpts *opts;
> +            case QEMU_OPTION_watchdog_action:
>                   opts = qemu_opts_create(qemu_find_opts("action"), NULL, 0, &error_abort);
>                   qemu_opt_set(opts, "watchdog", optarg, &error_abort);
>                   break;
> -            }
>               case QEMU_OPTION_parallel:
>                   add_device_config(DEV_PARALLEL, optarg);
>                   default_parallel = 0;

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>