diff mbox series

[v1,06/59] mips-semi.c: remove 'uhi_done' label in helper_do_semihosting()

Message ID 20200106182425.20312-7-danielhb413@gmail.com
State New
Headers show
Series trivial unneeded labels cleanup | expand

Commit Message

Daniel Henrique Barboza Jan. 6, 2020, 6:23 p.m. UTC
The label 'uhi_done' is a simple 'return' call and can
be removed for a bit more clarity in the code.

CC: Aurelien Jarno <aurelien@aurel32.net>
CC: Aleksandar Markovic <amarkovic@wavecomp.com>
CC: Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 target/mips/mips-semi.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Comments

Aleksandar Markovic Jan. 9, 2020, 8:41 p.m. UTC | #1
On Monday, January 6, 2020, Daniel Henrique Barboza <danielhb413@gmail.com>
wrote:

> The label 'uhi_done' is a simple 'return' call and can
> be removed for a bit more clarity in the code.
>
> CC: Aurelien Jarno <aurelien@aurel32.net>
> CC: Aleksandar Markovic <amarkovic@wavecomp.com>
> CC: Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> ---
>  target/mips/mips-semi.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
>
>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>


> diff --git a/target/mips/mips-semi.c b/target/mips/mips-semi.c
> index 35bdfd7c77..10a710c1e8 100644
> --- a/target/mips/mips-semi.c
> +++ b/target/mips/mips-semi.c
> @@ -218,7 +218,7 @@ static int copy_argn_to_target(CPUMIPSState *env, int
> arg_num,
>          if (!p) {                               \
>              gpr[2] = -1;                        \
>              gpr[3] = EFAULT;                    \
> -            goto uhi_done;                      \
> +            return;                             \
>          }                                       \
>      } while (0)
>
> @@ -228,14 +228,14 @@ static int copy_argn_to_target(CPUMIPSState *env,
> int arg_num,
>          if (!p) {                                       \
>              gpr[2] = -1;                                \
>              gpr[3] = EFAULT;                            \
> -            goto uhi_done;                              \
> +            return;                                     \
>          }                                               \
>          p2 = lock_user_string(addr2);                   \
>          if (!p2) {                                      \
>              unlock_user(p, addr, 0);                    \
>              gpr[2] = -1;                                \
>              gpr[3] = EFAULT;                            \
> -            goto uhi_done;                              \
> +            return;                                     \
>          }                                               \
>      } while (0)
>
> @@ -272,7 +272,7 @@ void helper_do_semihosting(CPUMIPSState *env)
>          if (gpr[4] < 3) {
>              /* ignore closing stdin/stdout/stderr */
>              gpr[2] = 0;
> -            goto uhi_done;
> +            return;
>          }
>          gpr[2] = close(gpr[4]);
>          gpr[3] = errno_mips(errno);
> @@ -302,7 +302,7 @@ void helper_do_semihosting(CPUMIPSState *env)
>              gpr[2] = fstat(gpr[4], &sbuf);
>              gpr[3] = errno_mips(errno);
>              if (gpr[2]) {
> -                goto uhi_done;
> +                return;
>              }
>              gpr[2] = copy_stat_to_target(env, &sbuf, gpr[5]);
>              gpr[3] = errno_mips(errno);
> @@ -314,14 +314,14 @@ void helper_do_semihosting(CPUMIPSState *env)
>      case UHI_argnlen:
>          if (gpr[4] >= semihosting_get_argc()) {
>              gpr[2] = -1;
> -            goto uhi_done;
> +            return;
>          }
>          gpr[2] = strlen(semihosting_get_arg(gpr[4]));
>          break;
>      case UHI_argn:
>          if (gpr[4] >= semihosting_get_argc()) {
>              gpr[2] = -1;
> -            goto uhi_done;
> +            return;
>          }
>          gpr[2] = copy_argn_to_target(env, gpr[4], gpr[5]);
>          break;
> @@ -369,6 +369,5 @@ void helper_do_semihosting(CPUMIPSState *env)
>          fprintf(stderr, "Unknown UHI operation %d\n", op);
>          abort();
>      }
> -uhi_done:
>      return;
>  }
> --
> 2.24.1
>
>
>
Aleksandar Markovic Jan. 24, 2020, 5:22 p.m. UTC | #2
On Mon, Jan 6, 2020 at 7:29 PM Daniel Henrique Barboza <
danielhb413@gmail.com> wrote:

> The label 'uhi_done' is a simple 'return' call and can
> be removed for a bit more clarity in the code.
>
> CC: Aurelien Jarno <aurelien@aurel32.net>
> CC: Aleksandar Markovic <amarkovic@wavecomp.com>
> CC: Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> ---
>  target/mips/mips-semi.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
>
>
Applied to MIPS queue.


> diff --git a/target/mips/mips-semi.c b/target/mips/mips-semi.c
> index 35bdfd7c77..10a710c1e8 100644
> --- a/target/mips/mips-semi.c
> +++ b/target/mips/mips-semi.c
> @@ -218,7 +218,7 @@ static int copy_argn_to_target(CPUMIPSState *env, int
> arg_num,
>          if (!p) {                               \
>              gpr[2] = -1;                        \
>              gpr[3] = EFAULT;                    \
> -            goto uhi_done;                      \
> +            return;                             \
>          }                                       \
>      } while (0)
>
> @@ -228,14 +228,14 @@ static int copy_argn_to_target(CPUMIPSState *env,
> int arg_num,
>          if (!p) {                                       \
>              gpr[2] = -1;                                \
>              gpr[3] = EFAULT;                            \
> -            goto uhi_done;                              \
> +            return;                                     \
>          }                                               \
>          p2 = lock_user_string(addr2);                   \
>          if (!p2) {                                      \
>              unlock_user(p, addr, 0);                    \
>              gpr[2] = -1;                                \
>              gpr[3] = EFAULT;                            \
> -            goto uhi_done;                              \
> +            return;                                     \
>          }                                               \
>      } while (0)
>
> @@ -272,7 +272,7 @@ void helper_do_semihosting(CPUMIPSState *env)
>          if (gpr[4] < 3) {
>              /* ignore closing stdin/stdout/stderr */
>              gpr[2] = 0;
> -            goto uhi_done;
> +            return;
>          }
>          gpr[2] = close(gpr[4]);
>          gpr[3] = errno_mips(errno);
> @@ -302,7 +302,7 @@ void helper_do_semihosting(CPUMIPSState *env)
>              gpr[2] = fstat(gpr[4], &sbuf);
>              gpr[3] = errno_mips(errno);
>              if (gpr[2]) {
> -                goto uhi_done;
> +                return;
>              }
>              gpr[2] = copy_stat_to_target(env, &sbuf, gpr[5]);
>              gpr[3] = errno_mips(errno);
> @@ -314,14 +314,14 @@ void helper_do_semihosting(CPUMIPSState *env)
>      case UHI_argnlen:
>          if (gpr[4] >= semihosting_get_argc()) {
>              gpr[2] = -1;
> -            goto uhi_done;
> +            return;
>          }
>          gpr[2] = strlen(semihosting_get_arg(gpr[4]));
>          break;
>      case UHI_argn:
>          if (gpr[4] >= semihosting_get_argc()) {
>              gpr[2] = -1;
> -            goto uhi_done;
> +            return;
>          }
>          gpr[2] = copy_argn_to_target(env, gpr[4], gpr[5]);
>          break;
> @@ -369,6 +369,5 @@ void helper_do_semihosting(CPUMIPSState *env)
>          fprintf(stderr, "Unknown UHI operation %d\n", op);
>          abort();
>      }
> -uhi_done:
>      return;
>  }
> --
> 2.24.1
>
>
>
diff mbox series

Patch

diff --git a/target/mips/mips-semi.c b/target/mips/mips-semi.c
index 35bdfd7c77..10a710c1e8 100644
--- a/target/mips/mips-semi.c
+++ b/target/mips/mips-semi.c
@@ -218,7 +218,7 @@  static int copy_argn_to_target(CPUMIPSState *env, int arg_num,
         if (!p) {                               \
             gpr[2] = -1;                        \
             gpr[3] = EFAULT;                    \
-            goto uhi_done;                      \
+            return;                             \
         }                                       \
     } while (0)
 
@@ -228,14 +228,14 @@  static int copy_argn_to_target(CPUMIPSState *env, int arg_num,
         if (!p) {                                       \
             gpr[2] = -1;                                \
             gpr[3] = EFAULT;                            \
-            goto uhi_done;                              \
+            return;                                     \
         }                                               \
         p2 = lock_user_string(addr2);                   \
         if (!p2) {                                      \
             unlock_user(p, addr, 0);                    \
             gpr[2] = -1;                                \
             gpr[3] = EFAULT;                            \
-            goto uhi_done;                              \
+            return;                                     \
         }                                               \
     } while (0)
 
@@ -272,7 +272,7 @@  void helper_do_semihosting(CPUMIPSState *env)
         if (gpr[4] < 3) {
             /* ignore closing stdin/stdout/stderr */
             gpr[2] = 0;
-            goto uhi_done;
+            return;
         }
         gpr[2] = close(gpr[4]);
         gpr[3] = errno_mips(errno);
@@ -302,7 +302,7 @@  void helper_do_semihosting(CPUMIPSState *env)
             gpr[2] = fstat(gpr[4], &sbuf);
             gpr[3] = errno_mips(errno);
             if (gpr[2]) {
-                goto uhi_done;
+                return;
             }
             gpr[2] = copy_stat_to_target(env, &sbuf, gpr[5]);
             gpr[3] = errno_mips(errno);
@@ -314,14 +314,14 @@  void helper_do_semihosting(CPUMIPSState *env)
     case UHI_argnlen:
         if (gpr[4] >= semihosting_get_argc()) {
             gpr[2] = -1;
-            goto uhi_done;
+            return;
         }
         gpr[2] = strlen(semihosting_get_arg(gpr[4]));
         break;
     case UHI_argn:
         if (gpr[4] >= semihosting_get_argc()) {
             gpr[2] = -1;
-            goto uhi_done;
+            return;
         }
         gpr[2] = copy_argn_to_target(env, gpr[4], gpr[5]);
         break;
@@ -369,6 +369,5 @@  void helper_do_semihosting(CPUMIPSState *env)
         fprintf(stderr, "Unknown UHI operation %d\n", op);
         abort();
     }
-uhi_done:
     return;
 }