Skip to content

Commit e698a51

Browse files
arndbtorvalds
authored andcommitted
drivers/rtc/rtc-pcf8563.c: fix uninitialized use warning
gcc-4.9 found a potential condition under which the 'pending' variable may be used uninitialized: drivers/rtc/rtc-pcf8563.c: In function 'pcf8563_irq': drivers/rtc/rtc-pcf8563.c:173:5: warning: 'pending' may be used uninitialized in this function [-Wmaybe-uninitialized] This is because in the pcf8563_get_alarm_mode() function, we check any nonzero return of pcf8563_read_block_data, but in the irq function we only check for negative values, so a possible positive value does not get detected if the compiler chooses not to inline the entire call chain. Checking for any non-zero value in the interrupt handler as well is just as correct and lets the compiler know what we are doing, without needing a bogus initialization. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> 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>
1 parent a4d4121 commit e698a51

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/rtc/rtc-pcf8563.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static irqreturn_t pcf8563_irq(int irq, void *dev_id)
167167
char pending;
168168

169169
err = pcf8563_get_alarm_mode(pcf8563->client, NULL, &pending);
170-
if (err < 0)
170+
if (err)
171171
return err;
172172

173173
if (pending) {

0 commit comments

Comments
 (0)