leds: tca6507: silence an uninitialized variable warning
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 14 Apr 2016 09:36:16 +0000 (12:36 +0300)
committerJacek Anaszewski <j.anaszewski@samsung.com>
Thu, 14 Apr 2016 11:08:58 +0000 (13:08 +0200)
If choose_times() returns -EINVAL that means "c1" and "c2" haven't been
initialized.  I've added a check for that.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
drivers/leds/leds-tca6507.c

index c548ea10f0f036648d1d357f998641551ff3f2a6..45222a7f4f75636d628596d90d9bdb29acf0b453 100644 (file)
@@ -327,6 +327,8 @@ static void set_times(struct tca6507_chip *tca, int bank)
        int result;
 
        result = choose_times(tca->bank[bank].ontime, &c1, &c2);
+       if (result < 0)
+               return;
        dev_dbg(&tca->client->dev,
                "Chose on  times %d(%d) %d(%d) for %dms\n",
                c1, time_codes[c1],