linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: Fix get_key_haup_common.isra.4() debug message to print ptoggle value
@ 2016-11-07 15:41 Shuah Khan
  2016-11-07 15:41 ` [PATCH] media: fix uninitialized variable warning in dib0700_rc_urb_completion() Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Shuah Khan @ 2016-11-07 15:41 UTC (permalink / raw)
  To: mchehab, javier, arnd, sean; +Cc: Shuah Khan, linux-media, linux-kernel

Fix the debug message in get_key_haup_common.isra.4() doesn't print the
correct toggle value. Fix it. This shows up as an used uninitialized warn
message:

drivers/media/i2c/ir-kbd-i2c.c: In function ‘get_key_haup_common.isra.4’:
 drivers/media/i2c/ir-kbd-i2c.c:62:2: warning: ‘toggle’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   printk(KERN_DEBUG MODULE_NAME ": " fmt , ## arg)
   ^~~~~~
 drivers/media/i2c/ir-kbd-i2c.c:70:20: note: ‘toggle’ was declared here
   int start, range, toggle, dev, code, ircode, vendor;
                     ^~~~~~

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 drivers/media/i2c/ir-kbd-i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c
index f95a6bc..cede397 100644
--- a/drivers/media/i2c/ir-kbd-i2c.c
+++ b/drivers/media/i2c/ir-kbd-i2c.c
@@ -118,7 +118,7 @@ static int get_key_haup_common(struct IR_i2c *ir, enum rc_type *protocol,
 			*protocol = RC_TYPE_RC6_MCE;
 			dev &= 0x7f;
 			dprintk(1, "ir hauppauge (rc6-mce): t%d vendor=%d dev=%d code=%d\n",
-						toggle, vendor, dev, code);
+						*ptoggle, vendor, dev, code);
 		} else {
 			*ptoggle = 0;
 			*protocol = RC_TYPE_RC6_6A_32;
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] media: fix uninitialized variable warning in dib0700_rc_urb_completion()
  2016-11-07 15:41 [PATCH] media: Fix get_key_haup_common.isra.4() debug message to print ptoggle value Shuah Khan
@ 2016-11-07 15:41 ` Shuah Khan
  2016-11-08 11:23   ` Sean Young
  0 siblings, 1 reply; 3+ messages in thread
From: Shuah Khan @ 2016-11-07 15:41 UTC (permalink / raw)
  To: mchehab, wsa-dev, gregkh, keescook, akpm, sean, patrick.boettcher
  Cc: Shuah Khan, linux-media, linux-kernel

Fix the following uninitialized variable compiler warning:

drivers/media/usb/dvb-usb/dib0700_core.c: In function ‘dib0700_rc_urb_completion’:
 drivers/media/usb/dvb-usb/dib0700_core.c:763:2: warning: ‘protocol’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   rc_keydown(d->rc_dev, protocol, keycode, toggle);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 drivers/media/usb/dvb-usb/dib0700_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c
index f319665..cfe28ec 100644
--- a/drivers/media/usb/dvb-usb/dib0700_core.c
+++ b/drivers/media/usb/dvb-usb/dib0700_core.c
@@ -676,7 +676,7 @@ static void dib0700_rc_urb_completion(struct urb *purb)
 {
 	struct dvb_usb_device *d = purb->context;
 	struct dib0700_rc_response *poll_reply;
-	enum rc_type protocol;
+	enum rc_type protocol = RC_TYPE_UNKNOWN;
 	u32 uninitialized_var(keycode);
 	u8 toggle;
 
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: fix uninitialized variable warning in dib0700_rc_urb_completion()
  2016-11-07 15:41 ` [PATCH] media: fix uninitialized variable warning in dib0700_rc_urb_completion() Shuah Khan
@ 2016-11-08 11:23   ` Sean Young
  0 siblings, 0 replies; 3+ messages in thread
From: Sean Young @ 2016-11-08 11:23 UTC (permalink / raw)
  To: Shuah Khan
  Cc: mchehab, wsa-dev, gregkh, keescook, akpm, patrick.boettcher,
	linux-media, linux-kernel

On Mon, Nov 07, 2016 at 08:41:12AM -0700, Shuah Khan wrote:
> Fix the following uninitialized variable compiler warning:
> 
> drivers/media/usb/dvb-usb/dib0700_core.c: In function ‘dib0700_rc_urb_completion’:
>  drivers/media/usb/dvb-usb/dib0700_core.c:763:2: warning: ‘protocol’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>    rc_keydown(d->rc_dev, protocol, keycode, toggle);
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
>  drivers/media/usb/dvb-usb/dib0700_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c
> index f319665..cfe28ec 100644
> --- a/drivers/media/usb/dvb-usb/dib0700_core.c
> +++ b/drivers/media/usb/dvb-usb/dib0700_core.c
> @@ -676,7 +676,7 @@ static void dib0700_rc_urb_completion(struct urb *purb)
>  {
>  	struct dvb_usb_device *d = purb->context;
>  	struct dib0700_rc_response *poll_reply;
> -	enum rc_type protocol;
> +	enum rc_type protocol = RC_TYPE_UNKNOWN;
>  	u32 uninitialized_var(keycode);
>  	u8 toggle;
>  

There is another (better) fix for it here:

https://patchwork.linuxtv.org/patch/37516/


Thanks
Sean

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-08 11:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-07 15:41 [PATCH] media: Fix get_key_haup_common.isra.4() debug message to print ptoggle value Shuah Khan
2016-11-07 15:41 ` [PATCH] media: fix uninitialized variable warning in dib0700_rc_urb_completion() Shuah Khan
2016-11-08 11:23   ` Sean Young

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).