From: Lars-Peter Clausen Date: Wed, 26 Sep 2012 01:34:36 +0000 (+1000) Subject: drivers/rtc/rtc-jz4740.c: fix IRQ error check X-Git-Tag: next-20120927~1^2~92 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ee7f89e55f415490bec82407d7baf85cda05e84f;p=karo-tx-linux.git 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: // @@ type T; unsigned T i; @@ ( *i < 0 | *i >= 0 ) // Signed-off-by: Lars-Peter Clausen Cc: Alessandro Zummo Signed-off-by: Andrew Morton --- 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; };