diff mbox series

[v4,03/17] target/m68k: Fix coding style in m68k_interrupt_all

Message ID 20220430175342.370628-4-richard.henderson@linaro.org
State Superseded
Headers show
Series target/m68k: Conditional traps + trap cleanup | expand

Commit Message

Richard Henderson April 30, 2022, 5:53 p.m. UTC
Add parenthesis around & vs &&.

Remove assignment to sr in function call argument -- note that
sr is unused after the call, so the assignment was never needed,
only the result of the & expression.

Suggested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/m68k/op_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé May 22, 2022, 9:47 p.m. UTC | #1
On 30/4/22 19:53, Richard Henderson wrote:
> Add parenthesis around & vs &&.
> 
> Remove assignment to sr in function call argument -- note that
> sr is unused after the call, so the assignment was never needed,
> only the result of the & expression.
> 
> Suggested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/m68k/op_helper.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Laurent Vivier May 25, 2022, 6:32 p.m. UTC | #2
Le 30/04/2022 à 19:53, Richard Henderson a écrit :
> Add parenthesis around & vs &&.
> 
> Remove assignment to sr in function call argument -- note that
> sr is unused after the call, so the assignment was never needed,
> only the result of the & expression.
> 
> Suggested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/m68k/op_helper.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
> index 2b94a6ec84..0f41c2dce3 100644
> --- a/target/m68k/op_helper.c
> +++ b/target/m68k/op_helper.c
> @@ -408,11 +408,11 @@ static void m68k_interrupt_all(CPUM68KState *env, int is_hw)
>           break;
>   
>       case EXCP_SPURIOUS ... EXCP_INT_LEVEL_7:
> -        if (is_hw && oldsr & SR_M) {
> +        if (is_hw && (oldsr & SR_M)) {
>               do_stack_frame(env, &sp, 0, oldsr, 0, retaddr);
>               oldsr = sr;
>               env->aregs[7] = sp;
> -            cpu_m68k_set_sr(env, sr &= ~SR_M);
> +            cpu_m68k_set_sr(env, sr & ~SR_M);
>               sp = env->aregs[7];
>               if (!m68k_feature(env, M68K_FEATURE_UNALIGNED_DATA)) {
>                   sp &= ~1;

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
diff mbox series

Patch

diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
index 2b94a6ec84..0f41c2dce3 100644
--- a/target/m68k/op_helper.c
+++ b/target/m68k/op_helper.c
@@ -408,11 +408,11 @@  static void m68k_interrupt_all(CPUM68KState *env, int is_hw)
         break;
 
     case EXCP_SPURIOUS ... EXCP_INT_LEVEL_7:
-        if (is_hw && oldsr & SR_M) {
+        if (is_hw && (oldsr & SR_M)) {
             do_stack_frame(env, &sp, 0, oldsr, 0, retaddr);
             oldsr = sr;
             env->aregs[7] = sp;
-            cpu_m68k_set_sr(env, sr &= ~SR_M);
+            cpu_m68k_set_sr(env, sr & ~SR_M);
             sp = env->aregs[7];
             if (!m68k_feature(env, M68K_FEATURE_UNALIGNED_DATA)) {
                 sp &= ~1;