]> 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, 21 Sep 2012 01:02:18 +0000 (11:02 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 25 Sep 2012 08:46:42 +0000 (18:46 +1000)
commit316dc804fba2824714a2dabc7f90f23e1f24061b
treeeab502884aed5a06eb42685afe5168420379ebf8
parente9eac6d4ad6c774157078068496433ce32b1c32f
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