diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2012-10-05 02:14:00 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-05 20:05:03 +0200 |
commit | 7c6a52a090ce7f680077ed42326e11cf17e713dc (patch) | |
tree | c04511e2e8078c4ef540d59406f3d16d46a390e8 /drivers/rtc/rtc-jz4740.c | |
parent | rtc: kconfig: remove unnecessary dependencies. (diff) | |
download | linux-7c6a52a090ce7f680077ed42326e11cf17e713dc.tar.xz linux-7c6a52a090ce7f680077ed42326e11cf17e713dc.zip |
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>
Diffstat (limited to 'drivers/rtc/rtc-jz4740.c')
-rw-r--r-- | drivers/rtc/rtc-jz4740.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c index 05ab227eeff7..1224182d3eab 100644 --- a/drivers/rtc/rtc-jz4740.c +++ b/drivers/rtc/rtc-jz4740.c @@ -42,7 +42,7 @@ struct jz4740_rtc { struct rtc_device *rtc; - unsigned int irq; + int irq; spinlock_t lock; }; |