[PATCH -mm] mpt fusion: Shut up uninitialized variable warnings

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linux Kernel Mailing List <linux-kernel@...>
Cc: Eric Moore <Eric.Moore@...>, James Bottomley <james.bottomley@...>, <support@...>, <mpt_linux_developer@...>
Date: Sunday, September 2, 2007 - 4:20 pm

drivers/message/fusion/mptctl.c: In function $B!F(Jmptctl_mpt_command$B!G(J:
drivers/message/fusion/mptctl.c:1764: warning: $B!F(JbufIn.len$B!G(J may be used uninitialized in this function
drivers/message/fusion/mptctl.c:1765: warning: $B!F(JbufOut.len$B!G(J may be used uninitialized in this function

come because gcc gets confused by some "goto" statements in above function.
The warnings have been verified to be bogus, however, the function does
initialize these later (after the offending goto's) in the function anyway.
So let's move those initializations to top of function, thereby also shutting
up these warnings.

Signed-off-by: Satyam Sharma <satyam@infradead.org>

---

 drivers/message/fusion/mptctl.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

--- linux-2.6.23-rc4-mm1/drivers/message/fusion/mptctl.c~fix	2007-09-02 21:51:14.000000000 +0530
+++ linux-2.6.23-rc4-mm1/drivers/message/fusion/mptctl.c	2007-09-02 21:54:25.000000000 +0530
@@ -1773,7 +1773,10 @@ mptctl_do_mpt_command (struct mpt_ioctl_
 	ulong 		timeout;
 	struct scsi_device *sdev;
 
+	/* bufIn and bufOut are used for user to kernel space transfers
+	 */
 	bufIn.kptr = bufOut.kptr = NULL;
+	bufIn.len = bufOut.len = 0;
 
 	if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
 	    (ioc == NULL)) {
@@ -2107,11 +2110,6 @@ mptctl_do_mpt_command (struct mpt_ioctl_
 	psge = (char *) (((int *) mf) + karg.dataSgeOffset);
 	flagsLength = 0;
 
-	/* bufIn and bufOut are used for user to kernel space transfers
-	 */
-	bufIn.kptr = bufOut.kptr = NULL;
-	bufIn.len = bufOut.len = 0;
-
 	if (karg.dataOutSize > 0)
 		sgSize ++;
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[-mm patchset] War on warnings, Satyam Sharma, (Sun Sep 2, 4:02 pm)
[PATCH -mm] mpt fusion: Shut up uninitialized variable warni..., Satyam Sharma, (Sun Sep 2, 4:20 pm)
[PATCH -mm] net/wireless/sysfs.c: Shut up build warning, Satyam Sharma, (Sun Sep 2, 4:11 pm)
[PATCH -mm] sisusbvga: Fix bug and build warnings, Satyam Sharma, (Sun Sep 2, 4:07 pm)
Re: [PATCH -mm] sisusbvga: Fix bug and build warnings, Satyam Sharma, (Sun Sep 2, 4:32 pm)
Re: [-mm patchset] War on warnings, Jesper Juhl, (Sun Sep 2, 4:04 pm)
Re: [-mm patchset] War on warnings, Satyam Sharma, (Sun Sep 2, 4:39 pm)