LoongArch: Fix unsigned comparison with less than zero

Message ID 63425a0e.b8.1844c7a5d80.Coremail.wangkailong@jari.cn
State New
Headers
Series LoongArch: Fix unsigned comparison with less than zero |

Commit Message

KaiLong Wang Nov. 6, 2022, 10:26 a.m. UTC
  Eliminate the following coccicheck warning:

./arch/loongarch/kernel/unwind_prologue.c:84:5-13: WARNING: Unsigned
expression compared with zero: frame_ra < 0

Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
---
 arch/loongarch/kernel/unwind_prologue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Huacai Chen Nov. 6, 2022, 2:33 p.m. UTC | #1
Queued for loongarch-fixes, thanks.

Huacai

On Sun, Nov 6, 2022 at 6:32 PM <wangkailong@jari.cn> wrote:
>
> Eliminate the following coccicheck warning:
>
> ./arch/loongarch/kernel/unwind_prologue.c:84:5-13: WARNING: Unsigned
> expression compared with zero: frame_ra < 0
>
> Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
> ---
>  arch/loongarch/kernel/unwind_prologue.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/loongarch/kernel/unwind_prologue.c b/arch/loongarch/kernel/unwind_prologue.c
> index b206d9159205..58ccdbe7fa22 100644
> --- a/arch/loongarch/kernel/unwind_prologue.c
> +++ b/arch/loongarch/kernel/unwind_prologue.c
> @@ -43,7 +43,8 @@ static bool unwind_by_prologue(struct unwind_state *state)
>  {
>         struct stack_info *info = &state->stack_info;
>         union loongarch_instruction *ip, *ip_end;
> -       unsigned long frame_size = 0, frame_ra = -1;
> +       unsigned long frame_size = 0;
> +       long frame_ra = -1;
>         unsigned long size, offset, pc = state->pc;
>
>         if (state->sp >= info->end || state->sp < info->begin)
> --
> 2.25.1
  

Patch

diff --git a/arch/loongarch/kernel/unwind_prologue.c b/arch/loongarch/kernel/unwind_prologue.c
index b206d9159205..58ccdbe7fa22 100644
--- a/arch/loongarch/kernel/unwind_prologue.c
+++ b/arch/loongarch/kernel/unwind_prologue.c
@@ -43,7 +43,8 @@  static bool unwind_by_prologue(struct unwind_state *state)
 {
 	struct stack_info *info = &state->stack_info;
 	union loongarch_instruction *ip, *ip_end;
-	unsigned long frame_size = 0, frame_ra = -1;
+	unsigned long frame_size = 0;
+	long frame_ra = -1;
 	unsigned long size, offset, pc = state->pc;
 
 	if (state->sp >= info->end || state->sp < info->begin)