]> 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>
Thu, 13 Sep 2012 01:01:19 +0000 (11:01 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 17 Sep 2012 10:46:13 +0000 (20:46 +1000)
commitae32795da677b65bba72202b13dbf26853afdf32
tree0025a3d34940628ee8ba64080758d11b24125448
parent9a7b2a04b07daab6fce8896e635d3dc920c23626
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