Skip to contentSkip to conversation

leds: tca6507: silence an uninitialized variable warning

PATCH Applied Dan Carpenter 2 participants 2 messages Apr 14, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 leds: tca6507: silence an uninitialized variable warning

If choose_times() returns -EINVAL that means "c1" and "c2" haven't been initialized. I've added a check for that.

drivers/leds/leds-tca6507.c +2 -0
index c548ea1..45222a7 100644
@@ -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],
#1 lore raw

Hi Dan,

Thanks for the patch.

Applied to the for-next branch of linux-leds.git.

Thanks,
Jacek Anaszewski

Quoted 20 lines · Dan Carpenter

If choose_times() returns -EINVAL that means "c1" and "c2" haven't been initialized. I've added a check for that.

drivers/leds/leds-tca6507.c +2 -0
index c548ea1..45222a7 100644
@@ -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],