]> git.baikalelectronics.ru Git - kernel.git/commitdiff
LoongArch: Fix unsigned comparison with less than zero
authorYang Li <yang.lee@linux.alibaba.com>
Sat, 6 Aug 2022 07:19:33 +0000 (15:19 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Fri, 12 Aug 2022 05:10:10 +0000 (13:10 +0800)
The return value from the call to get_timer_irq() is int, which can be
a negative error code. However, the return value 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>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/kernel/time.c

index 79dc5eddf504adb943a6dc21e83c1ec3fd4a480b..786735dcc8d678ecc6022ca8e8060a0bd4a4153a 100644 (file)
@@ -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;