rtc: pfc8563: fix uninitialized variable warning
authorArnd Bergmann <arnd@arndb.de>
Tue, 12 May 2015 21:27:02 +0000 (23:27 +0200)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Wed, 24 Jun 2015 23:13:46 +0000 (01:13 +0200)
Gcc is unable to prove that alm_pending is always initialized
when it is used, so it prints a harmless warning:

drivers/rtc/rtc-pcf8563.c: In function 'pcf8563_probe':
drivers/rtc/rtc-pcf8563.c:449:5: warning: 'alm_pending' may be used uninitialized in this function [-Wmaybe-uninitialized]

This uses the same conditional expression that is used inside of
the pcf8563_get_alarm_mode() function, to help gcc figure it out
and shut up that warning, and make the ARM defconfigs build again
with no warnings.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: a45d528aab8b ("rtc: pcf8563: clear expired alarm at boot time")
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-pcf8563.c

index fc564d359941b1dfb21eb8595a3f1c604f5a8f7b..8bba022be946ebc4380bc692c78637ff487c292a 100644 (file)
@@ -432,7 +432,7 @@ static int pcf8563_probe(struct i2c_client *client,
        }
 
        err = pcf8563_get_alarm_mode(client, NULL, &alm_pending);
-       if (err < 0) {
+       if (err) {
                dev_err(&client->dev, "%s: read error\n", __func__);
                return err;
        }