linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] renesas; Silence uninitialized variable report in usbhsg_recip_run_handle()
@ 2012-01-16 21:42 Jesper Juhl
  2012-01-24  8:11 ` Felipe Balbi
  0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2012-01-16 21:42 UTC (permalink / raw)
  To: linux-usb
  Cc: linux-kernel, Felipe Balbi, Greg Kroah-Hartman, Kuninori Morimoto

In drivers/usb/renesas_usbhs/mod_gadget.c::usbhsg_recip_run_handle()
the Coverity Prevent checker currently flags a warning about possibly
uninitialized use of 'ret' i usbhsg_recip_run_handle(). It does this
since it assumes we take one of the non-default branches in the switch
and then subsequently take the false branch in the 'if (func)' case
below. This exact scenario will never happen, but Coverity can't see
that for some reason. This patch initializes 'ret' to '0' when it is
declared which should shut up this report and won't really hurt - so
why not? At least then it's clear that 'ret' is always initialized..

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/usb/renesas_usbhs/mod_gadget.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index 528691d5f..7542aa9 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -425,7 +425,7 @@ static int usbhsg_recip_run_handle(struct usbhs_priv *priv,
 	struct usbhs_pipe *pipe;
 	int recip = ctrl->bRequestType & USB_RECIP_MASK;
 	int nth = le16_to_cpu(ctrl->wIndex) & USB_ENDPOINT_NUMBER_MASK;
-	int ret;
+	int ret = 0;
 	int (*func)(struct usbhs_priv *priv, struct usbhsg_uep *uep,
 		    struct usb_ctrlrequest *ctrl);
 	char *msg;
-- 
1.7.8.3


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


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

* Re: [PATCH] renesas; Silence uninitialized variable report in usbhsg_recip_run_handle()
  2012-01-16 21:42 [PATCH] renesas; Silence uninitialized variable report in usbhsg_recip_run_handle() Jesper Juhl
@ 2012-01-24  8:11 ` Felipe Balbi
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe Balbi @ 2012-01-24  8:11 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: linux-usb, linux-kernel, Felipe Balbi, Greg Kroah-Hartman,
	Kuninori Morimoto

[-- Attachment #1: Type: text/plain, Size: 798 bytes --]

On Mon, Jan 16, 2012 at 10:42:10PM +0100, Jesper Juhl wrote:
> In drivers/usb/renesas_usbhs/mod_gadget.c::usbhsg_recip_run_handle()
> the Coverity Prevent checker currently flags a warning about possibly
> uninitialized use of 'ret' i usbhsg_recip_run_handle(). It does this
> since it assumes we take one of the non-default branches in the switch
> and then subsequently take the false branch in the 'if (func)' case
> below. This exact scenario will never happen, but Coverity can't see
> that for some reason. This patch initializes 'ret' to '0' when it is
> declared which should shut up this report and won't really hurt - so
> why not? At least then it's clear that 'ret' is always initialized..
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

applied, thanks

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2012-01-24  8:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-16 21:42 [PATCH] renesas; Silence uninitialized variable report in usbhsg_recip_run_handle() Jesper Juhl
2012-01-24  8:11 ` Felipe Balbi

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).