]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
drivers/rtc/rtc-jz4740.c: fix IRQ error check
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 28 Sep 2012 00:20:34 +0000 (10:20 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 4 Oct 2012 05:03:54 +0000 (15:03 +1000)
commita3497ad75b07544740dc5dd9778e9b39420d9293
treeaf6d536601d5c971eccba05645a9231f6119e1bb
parentd5c49f07257c63f187f1de4c86ccea54455d4a2e
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