diff mbox

[09/26] qemu-user: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)

Message ID 1474034177-17663-10-git-send-email-lvivier@redhat.com
State New
Headers show

Commit Message

Laurent Vivier Sept. 16, 2016, 1:56 p.m. UTC
This patch is the result of coccinelle script
scripts/coccinelle/exit.cocci

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
CC: Riku Voipio <riku.voipio@iki.fi>
---
 bsd-user/main.c      | 20 ++++++++++----------
 linux-user/main.c    |  4 ++--
 linux-user/syscall.c |  2 +-
 3 files changed, 13 insertions(+), 13 deletions(-)

Comments

Riku Voipio Sept. 21, 2016, 7:21 p.m. UTC | #1
On Fri, Sep 16, 2016 at 03:56:00PM +0200, Laurent Vivier wrote:
> This patch is the result of coccinelle script
> scripts/coccinelle/exit.cocci
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> CC: Riku Voipio <riku.voipio@iki.fi>

Acked-by: Riku Voipio <riku.voipio@iki.fi>

> ---
>  bsd-user/main.c      | 20 ++++++++++----------
>  linux-user/main.c    |  4 ++--
>  linux-user/syscall.c |  2 +-
>  3 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/bsd-user/main.c b/bsd-user/main.c
> index 0fb08e4..e47e4d7 100644
> --- a/bsd-user/main.c
> +++ b/bsd-user/main.c
> @@ -658,7 +658,7 @@ void cpu_loop(CPUSPARCState *env)
>  #endif
>              printf ("Unhandled trap: 0x%x\n", trapnr);
>              cpu_dump_state(cs, stderr, fprintf, 0);
> -            exit (1);
> +            exit(EXIT_FAILURE);
>          }
>          process_pending_signals (env);
>      }
> @@ -708,7 +708,7 @@ static void usage(void)
>             TARGET_NAME,
>             interp_prefix,
>             x86_stack_size);
> -    exit(1);
> +    exit(EXIT_FAILURE);
>  }
>  
>  THREAD CPUState *thread_cpu;
> @@ -752,7 +752,7 @@ int main(int argc, char **argv)
>  
>      if ((envlist = envlist_create()) == NULL) {
>          (void) fprintf(stderr, "Unable to allocate envlist\n");
> -        exit(1);
> +        exit(EXIT_FAILURE);
>      }
>  
>      /* add current environment into the list */
> @@ -793,7 +793,7 @@ int main(int argc, char **argv)
>              envlist_free(envlist);
>              if ((envlist = envlist_create()) == NULL) {
>                  (void) fprintf(stderr, "Unable to allocate envlist\n");
> -                exit(1);
> +                exit(EXIT_FAILURE);
>              }
>          } else if (!strcmp(r, "U")) {
>              r = argv[optind++];
> @@ -815,7 +815,7 @@ int main(int argc, char **argv)
>              if (qemu_host_page_size == 0 ||
>                  (qemu_host_page_size & (qemu_host_page_size - 1)) != 0) {
>                  fprintf(stderr, "page size must be a power of two\n");
> -                exit(1);
> +                exit(EXIT_FAILURE);
>              }
>          } else if (!strcmp(r, "g")) {
>              gdbstub_port = atoi(argv[optind++]);
> @@ -828,7 +828,7 @@ int main(int argc, char **argv)
>  #if defined(cpu_list)
>                      cpu_list(stdout, &fprintf);
>  #endif
> -                exit(1);
> +                exit(EXIT_FAILURE);
>              }
>          } else if (!strcmp(r, "B")) {
>             guest_base = strtol(argv[optind++], NULL, 0);
> @@ -867,7 +867,7 @@ int main(int argc, char **argv)
>          mask = qemu_str_to_log_mask(log_mask);
>          if (!mask) {
>              qemu_print_log_usage(stdout);
> -            exit(1);
> +            exit(EXIT_FAILURE);
>          }
>          qemu_set_log(mask);
>      }
> @@ -878,7 +878,7 @@ int main(int argc, char **argv)
>      filename = argv[optind];
>  
>      if (!trace_init_backends()) {
> -        exit(1);
> +        exit(EXIT_FAILURE);
>      }
>      trace_init_file(trace_file);
>  
> @@ -914,7 +914,7 @@ int main(int argc, char **argv)
>      cpu = cpu_init(cpu_model);
>      if (!cpu) {
>          fprintf(stderr, "Unable to find CPU definition\n");
> -        exit(1);
> +        exit(EXIT_FAILURE);
>      }
>      env = cpu->env_ptr;
>  #if defined(TARGET_SPARC) || defined(TARGET_PPC)
> @@ -1010,7 +1010,7 @@ int main(int argc, char **argv)
>      /* enable 64 bit mode if possible */
>      if (!(env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM)) {
>          fprintf(stderr, "The selected x86 CPU does not support 64 bit mode\n");
> -        exit(1);
> +        exit(EXIT_FAILURE);
>      }
>      env->cr[4] |= CR4_PAE_MASK;
>      env->efer |= MSR_EFER_LMA | MSR_EFER_LME;
> diff --git a/linux-user/main.c b/linux-user/main.c
> index 3ad70f8..0ab5360 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -4243,7 +4243,7 @@ int main(int argc, char **argv, char **envp)
>      optind = parse_args(argc, argv);
>  
>      if (!trace_init_backends()) {
> -        exit(1);
> +        exit(EXIT_FAILURE);
>      }
>      trace_init_file(trace_file);
>  
> @@ -4700,7 +4700,7 @@ int main(int argc, char **argv, char **envp)
>              if ((env->active_fpu.fcr31_rw_bitmask &
>                    (1 << FCR31_NAN2008)) == 0) {
>                  fprintf(stderr, "ELF binary's NaN mode not supported by CPU\n");
> -                exit(1);
> +                exit(EXIT_FAILURE);
>              }
>              if ((info->elf_flags & EF_MIPS_NAN2008) != 0) {
>                  env->active_fpu.fcr31 |= (1 << FCR31_NAN2008);
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index ca06943..da1f581 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -6513,7 +6513,7 @@ void syscall_init(void)
>              if (arg_type[0] != TYPE_PTR) {
>                  fprintf(stderr, "cannot patch size for ioctl 0x%x\n",
>                          ie->target_cmd);
> -                exit(1);
> +                exit(EXIT_FAILURE);
>              }
>              arg_type++;
>              size = thunk_type_size(arg_type, 0);
> -- 
> 2.5.5
>
diff mbox

Patch

diff --git a/bsd-user/main.c b/bsd-user/main.c
index 0fb08e4..e47e4d7 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -658,7 +658,7 @@  void cpu_loop(CPUSPARCState *env)
 #endif
             printf ("Unhandled trap: 0x%x\n", trapnr);
             cpu_dump_state(cs, stderr, fprintf, 0);
-            exit (1);
+            exit(EXIT_FAILURE);
         }
         process_pending_signals (env);
     }
@@ -708,7 +708,7 @@  static void usage(void)
            TARGET_NAME,
            interp_prefix,
            x86_stack_size);
-    exit(1);
+    exit(EXIT_FAILURE);
 }
 
 THREAD CPUState *thread_cpu;
@@ -752,7 +752,7 @@  int main(int argc, char **argv)
 
     if ((envlist = envlist_create()) == NULL) {
         (void) fprintf(stderr, "Unable to allocate envlist\n");
-        exit(1);
+        exit(EXIT_FAILURE);
     }
 
     /* add current environment into the list */
@@ -793,7 +793,7 @@  int main(int argc, char **argv)
             envlist_free(envlist);
             if ((envlist = envlist_create()) == NULL) {
                 (void) fprintf(stderr, "Unable to allocate envlist\n");
-                exit(1);
+                exit(EXIT_FAILURE);
             }
         } else if (!strcmp(r, "U")) {
             r = argv[optind++];
@@ -815,7 +815,7 @@  int main(int argc, char **argv)
             if (qemu_host_page_size == 0 ||
                 (qemu_host_page_size & (qemu_host_page_size - 1)) != 0) {
                 fprintf(stderr, "page size must be a power of two\n");
-                exit(1);
+                exit(EXIT_FAILURE);
             }
         } else if (!strcmp(r, "g")) {
             gdbstub_port = atoi(argv[optind++]);
@@ -828,7 +828,7 @@  int main(int argc, char **argv)
 #if defined(cpu_list)
                     cpu_list(stdout, &fprintf);
 #endif
-                exit(1);
+                exit(EXIT_FAILURE);
             }
         } else if (!strcmp(r, "B")) {
            guest_base = strtol(argv[optind++], NULL, 0);
@@ -867,7 +867,7 @@  int main(int argc, char **argv)
         mask = qemu_str_to_log_mask(log_mask);
         if (!mask) {
             qemu_print_log_usage(stdout);
-            exit(1);
+            exit(EXIT_FAILURE);
         }
         qemu_set_log(mask);
     }
@@ -878,7 +878,7 @@  int main(int argc, char **argv)
     filename = argv[optind];
 
     if (!trace_init_backends()) {
-        exit(1);
+        exit(EXIT_FAILURE);
     }
     trace_init_file(trace_file);
 
@@ -914,7 +914,7 @@  int main(int argc, char **argv)
     cpu = cpu_init(cpu_model);
     if (!cpu) {
         fprintf(stderr, "Unable to find CPU definition\n");
-        exit(1);
+        exit(EXIT_FAILURE);
     }
     env = cpu->env_ptr;
 #if defined(TARGET_SPARC) || defined(TARGET_PPC)
@@ -1010,7 +1010,7 @@  int main(int argc, char **argv)
     /* enable 64 bit mode if possible */
     if (!(env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM)) {
         fprintf(stderr, "The selected x86 CPU does not support 64 bit mode\n");
-        exit(1);
+        exit(EXIT_FAILURE);
     }
     env->cr[4] |= CR4_PAE_MASK;
     env->efer |= MSR_EFER_LMA | MSR_EFER_LME;
diff --git a/linux-user/main.c b/linux-user/main.c
index 3ad70f8..0ab5360 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -4243,7 +4243,7 @@  int main(int argc, char **argv, char **envp)
     optind = parse_args(argc, argv);
 
     if (!trace_init_backends()) {
-        exit(1);
+        exit(EXIT_FAILURE);
     }
     trace_init_file(trace_file);
 
@@ -4700,7 +4700,7 @@  int main(int argc, char **argv, char **envp)
             if ((env->active_fpu.fcr31_rw_bitmask &
                   (1 << FCR31_NAN2008)) == 0) {
                 fprintf(stderr, "ELF binary's NaN mode not supported by CPU\n");
-                exit(1);
+                exit(EXIT_FAILURE);
             }
             if ((info->elf_flags & EF_MIPS_NAN2008) != 0) {
                 env->active_fpu.fcr31 |= (1 << FCR31_NAN2008);
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ca06943..da1f581 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6513,7 +6513,7 @@  void syscall_init(void)
             if (arg_type[0] != TYPE_PTR) {
                 fprintf(stderr, "cannot patch size for ioctl 0x%x\n",
                         ie->target_cmd);
-                exit(1);
+                exit(EXIT_FAILURE);
             }
             arg_type++;
             size = thunk_type_size(arg_type, 0);