diff mbox series

[1/1] lib: sign conflict in sbi_tlb_entry_process()

Message ID 20210621195010.33557-1-xypron.glpk@gmx.de
State Accepted
Headers show
Series [1/1] lib: sign conflict in sbi_tlb_entry_process() | expand

Commit Message

Heinrich Schuchardt June 21, 2021, 7:50 p.m. UTC
Compiling sbi_tlb_entry_process() with GCC 11 and -Wextra yields:

lib/sbi/sbi_tlb.c: In function ‘sbi_tlb_process_count’:
lib/sbi/sbi_tlb.c:206:31:
error: comparison of integer expressions of different signedness:
‘u32’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
  206 |                 if (deq_count > count)

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 lib/sbi/sbi_tlb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--
2.30.2

Comments

Atish Patra June 21, 2021, 8:04 p.m. UTC | #1
On Mon, Jun 21, 2021 at 12:50 PM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> Compiling sbi_tlb_entry_process() with GCC 11 and -Wextra yields:
>
> lib/sbi/sbi_tlb.c: In function ‘sbi_tlb_process_count’:
> lib/sbi/sbi_tlb.c:206:31:
> error: comparison of integer expressions of different signedness:
> ‘u32’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
>   206 |                 if (deq_count > count)
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  lib/sbi/sbi_tlb.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/sbi/sbi_tlb.c b/lib/sbi/sbi_tlb.c
> index 2ba1b7b..8bbe92b 100644
> --- a/lib/sbi/sbi_tlb.c
> +++ b/lib/sbi/sbi_tlb.c
> @@ -193,10 +193,11 @@ static void sbi_tlb_entry_process(struct sbi_tlb_info *tinfo)
>         }
>  }
>
> -static void sbi_tlb_process_count(struct sbi_scratch *scratch, int count)
> +static void sbi_tlb_process_count(struct sbi_scratch *scratch,
> +                                 unsigned int count)
>  {
>         struct sbi_tlb_info tinfo;
> -       u32 deq_count = 0;
> +       unsigned int deq_count = 0;
>         struct sbi_fifo *tlb_fifo =
>                         sbi_scratch_offset_ptr(scratch, tlb_fifo_off);
>
> --
> 2.30.2
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi


Reviewed-by: Atish Patra <atish.patra@wdc.com>

--
Regards,
Atish
Xiang W June 22, 2021, 6:41 a.m. UTC | #2
在 2021-06-21星期一的 21:50 +0200,Heinrich Schuchardt写道:
> Compiling sbi_tlb_entry_process() with GCC 11 and -Wextra yields:
> 
> lib/sbi/sbi_tlb.c: In function ‘sbi_tlb_process_count’:
> lib/sbi/sbi_tlb.c:206:31:
> error: comparison of integer expressions of different signedness:
> ‘u32’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
>   206 |                 if (deq_count > count)
> 
Reviewed-by: Xiang W <wxjstz@126.com>

Regards,
Xiang W

> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  lib/sbi/sbi_tlb.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/sbi/sbi_tlb.c b/lib/sbi/sbi_tlb.c
> index 2ba1b7b..8bbe92b 100644
> --- a/lib/sbi/sbi_tlb.c
> +++ b/lib/sbi/sbi_tlb.c
> @@ -193,10 +193,11 @@ static void sbi_tlb_entry_process(struct
> sbi_tlb_info *tinfo)
>         }
>  }
> 
> -static void sbi_tlb_process_count(struct sbi_scratch *scratch, int
> count)
> +static void sbi_tlb_process_count(struct sbi_scratch *scratch,
> +                                 unsigned int count)
>  {
>         struct sbi_tlb_info tinfo;
> -       u32 deq_count = 0;
> +       unsigned int deq_count = 0;
>         struct sbi_fifo *tlb_fifo =
>                         sbi_scratch_offset_ptr(scratch,
> tlb_fifo_off);
> 
> --
> 2.30.2
> 
>
Anup Patel June 22, 2021, 3 p.m. UTC | #3
On 22/06/21, 12:12 PM, "Xiang W" <wxjstz@126.com> wrote:

    在 2021-06-21星期一的 21:50 +0200,Heinrich Schuchardt写道:
    > Compiling sbi_tlb_entry_process() with GCC 11 and -Wextra yields:
    > 
    > lib/sbi/sbi_tlb.c: In function ‘sbi_tlb_process_count’:
    > lib/sbi/sbi_tlb.c:206:31:
    > error: comparison of integer expressions of different signedness:
    > ‘u32’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
    >   206 |                 if (deq_count > count)
    > 
    Reviewed-by: Xiang W <wxjstz@126.com>

Applied this patch to the riscv/opensbi repo.

Regards,
Anup

    > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
    > ---
    >  lib/sbi/sbi_tlb.c | 5 +++--
    >  1 file changed, 3 insertions(+), 2 deletions(-)
    > 
    > diff --git a/lib/sbi/sbi_tlb.c b/lib/sbi/sbi_tlb.c
    > index 2ba1b7b..8bbe92b 100644
    > --- a/lib/sbi/sbi_tlb.c
    > +++ b/lib/sbi/sbi_tlb.c
    > @@ -193,10 +193,11 @@ static void sbi_tlb_entry_process(struct
    > sbi_tlb_info *tinfo)
    >         }
    >  }
    > 
    > -static void sbi_tlb_process_count(struct sbi_scratch *scratch, int
    > count)
    > +static void sbi_tlb_process_count(struct sbi_scratch *scratch,
    > +                                 unsigned int count)
    >  {
    >         struct sbi_tlb_info tinfo;
    > -       u32 deq_count = 0;
    > +       unsigned int deq_count = 0;
    >         struct sbi_fifo *tlb_fifo =
    >                         sbi_scratch_offset_ptr(scratch,
    > tlb_fifo_off);
    > 
    > --
    > 2.30.2
    > 
    >
diff mbox series

Patch

diff --git a/lib/sbi/sbi_tlb.c b/lib/sbi/sbi_tlb.c
index 2ba1b7b..8bbe92b 100644
--- a/lib/sbi/sbi_tlb.c
+++ b/lib/sbi/sbi_tlb.c
@@ -193,10 +193,11 @@  static void sbi_tlb_entry_process(struct sbi_tlb_info *tinfo)
 	}
 }

-static void sbi_tlb_process_count(struct sbi_scratch *scratch, int count)
+static void sbi_tlb_process_count(struct sbi_scratch *scratch,
+				  unsigned int count)
 {
 	struct sbi_tlb_info tinfo;
-	u32 deq_count = 0;
+	unsigned int deq_count = 0;
 	struct sbi_fifo *tlb_fifo =
 			sbi_scratch_offset_ptr(scratch, tlb_fifo_off);