linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] LoongArch: Fix unsigned comparison with less than zero
@ 2022-07-22  0:42 Yang Li
  2022-07-22  2:41 ` Huacai Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2022-07-22  0:42 UTC (permalink / raw)
  To: chenhuacai; +Cc: kernel, loongarch, linux-kernel, Yang Li, Abaci Robot

The return from the call to get_timer_irq() is int, it can be
a negative error code, however this is being assigned to an
unsigned int variable 'irq', so making 'irq' an int.

Eliminate the following coccicheck warning:
./arch/loongarch/kernel/time.c:146:5-8: WARNING: Unsigned expression compared with zero: irq < 0

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 arch/loongarch/kernel/time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/loongarch/kernel/time.c b/arch/loongarch/kernel/time.c
index 79dc5eddf504..786735dcc8d6 100644
--- a/arch/loongarch/kernel/time.c
+++ b/arch/loongarch/kernel/time.c
@@ -135,7 +135,7 @@ static int get_timer_irq(void)
 
 int constant_clockevent_init(void)
 {
-	unsigned int irq;
+	int irq;
 	unsigned int cpu = smp_processor_id();
 	unsigned long min_delta = 0x600;
 	unsigned long max_delta = (1UL << 48) - 1;
-- 
2.20.1.7.g153144c


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] LoongArch: Fix unsigned comparison with less than zero
  2022-07-22  0:42 [PATCH -next] LoongArch: Fix unsigned comparison with less than zero Yang Li
@ 2022-07-22  2:41 ` Huacai Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Huacai Chen @ 2022-07-22  2:41 UTC (permalink / raw)
  To: Yang Li; +Cc: WANG Xuerui, loongarch, LKML, Abaci Robot

Hi, Yang Li,

Thank you for your patch. This looks good to me and will be queued for
5.20, since Marc said he will not rebase his branch. :)

Huacai

On Fri, Jul 22, 2022 at 8:42 AM Yang Li <yang.lee@linux.alibaba.com> wrote:
>
> The return from the call to get_timer_irq() is int, it can be
> a negative error code, however this is being assigned to an
> unsigned int variable 'irq', so making 'irq' an int.
>
> Eliminate the following coccicheck warning:
> ./arch/loongarch/kernel/time.c:146:5-8: WARNING: Unsigned expression compared with zero: irq < 0
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  arch/loongarch/kernel/time.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/loongarch/kernel/time.c b/arch/loongarch/kernel/time.c
> index 79dc5eddf504..786735dcc8d6 100644
> --- a/arch/loongarch/kernel/time.c
> +++ b/arch/loongarch/kernel/time.c
> @@ -135,7 +135,7 @@ static int get_timer_irq(void)
>
>  int constant_clockevent_init(void)
>  {
> -       unsigned int irq;
> +       int irq;
>         unsigned int cpu = smp_processor_id();
>         unsigned long min_delta = 0x600;
>         unsigned long max_delta = (1UL << 48) - 1;
> --
> 2.20.1.7.g153144c
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-22  2:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-22  0:42 [PATCH -next] LoongArch: Fix unsigned comparison with less than zero Yang Li
2022-07-22  2:41 ` Huacai Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).