Skip to content
Commit 7c6a52a0 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Linus Torvalds
Browse files

drivers/rtc/rtc-jz4740.c: fix IRQ error check



The irq field of the jz4740_irc struct is unsigned.  Yet we assign the
result of platform_get_irq() to it.  platform_get_irq() may return a
negative error code and the code checks for this condition by checking if
'irq' is less than zero.  But since 'irq' is unsigned this test will
always be false.  Fix it by making 'irq' signed.

The issue was found using the following coccinelle semantic patch:

//<smpl>
@@
type T;
unsigned T i;
@@
(
*i < 0
|
*i >= 0
)
//</smpl>

Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6b8029fa
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment