]> git.karo-electronics.de Git - karo-tx-linux.git/commit
drivers/rtc/rtc-jz4740.c: fix IRQ error check
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 7 Sep 2012 00:24:57 +0000 (10:24 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 7 Sep 2012 05:36:31 +0000 (15:36 +1000)
commit040ccf4ca9fa6ee39d317d8306950b9c8d0b878f
tree3dc8d688a3edd107d81fe2d2363e2c1cffeab05c
parent93d6b08de5205ab42588ca912a5aa1fb58c6d051
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>
drivers/rtc/rtc-jz4740.c