Skip to contentSkip to conversation

rc: Fix uninitialized variable in debug print

PATCH In review Geert Uytterhoeven 2 participants 2 messages Oct 13, 2016 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rc: Fix uninitialized variable in debug print

drivers/media/i2c/ir-kbd-i2c.c: In function ‘get_key_haup_common’:
drivers/media/i2c/ir-kbd-i2c.c:120: warning: ‘toggle’ is used uninitialized in this function

To fix this, use the intermediate "toggle" variable, like is done in other branches.

Fixes 00bb820755ed8ee9 ("[media] rc: Hauppauge z8f0811 can decode RC6")
---
 drivers/media/i2c/ir-kbd-i2c.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/i2c/ir-kbd-i2c.c +2 -1
index f95a6bc839d58f5f..0ab8e226c4cc0d19 100644
@@ -114,7 +114,8 @@ static int get_key_haup_common(struct IR_i2c *ir, enum rc_type *protocol,
 		vendor = get_unaligned_be16(buf + 1);
 
 		if (vendor == 0x800f) {
-			*ptoggle = (dev & 0x80) != 0;
+			toggle = (dev & 0x80) != 0;
+			*ptoggle = toggle;
 			*protocol = RC_TYPE_RC6_MCE;
 			dev &= 0x7f;
 			dprintk(1, "ir hauppauge (rc6-mce): t%d vendor=%d dev=%d code=%d\n",
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Geert Uytterhoeven

drivers/media/i2c/ir-kbd-i2c.c: In function ‘get_key_haup_common’:
drivers/media/i2c/ir-kbd-i2c.c:120: warning: ‘toggle’ is used uninitialized in this function

To fix this, use the intermediate "toggle" variable, like is done in other branches.

Fixes 00bb820755ed8ee9 ("[media] rc: Hauppauge z8f0811 can decode RC6")

Thanks for finding this and writing a patch.

Quoted 20 lines
---
 drivers/media/i2c/ir-kbd-i2c.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/i2c/ir-kbd-i2c.c +2 -1
index f95a6bc839d58f5f..0ab8e226c4cc0d19 100644
@@ -114,7 +114,8 @@ static int get_key_haup_common(struct IR_i2c *ir, enum rc_type *protocol,
 		vendor = get_unaligned_be16(buf + 1);
 
 		if (vendor == 0x800f) {
-			*ptoggle = (dev & 0x80) != 0;
+			toggle = (dev & 0x80) != 0;
+			*ptoggle = toggle;
 			*protocol = RC_TYPE_RC6_MCE;
 			dev &= 0x7f;
 			dprintk(1, "ir hauppauge (rc6-mce): t%d vendor=%d dev=%d code=%d\n",
Signature · 1 line
1.9.1