]> git.baikalelectronics.ru Git - kernel.git/commit
drivers/rtc/rtc-jz4740.c: fix IRQ error check
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 5 Oct 2012 00:14:00 +0000 (17:14 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Oct 2012 18:05:03 +0000 (03:05 +0900)
commit75d668492a85a384213098716e8512d176bd030a
treec04511e2e8078c4ef540d59406f3d16d46a390e8
parent2ddcf7d90104bb90fba2b39d3a22befa2dee13a5
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: Lars-Peter Clausen <lars@metafoo.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-jz4740.c