linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] qla4xxx: initialize some variables for gcc
@ 2010-08-13 21:03 Dan Carpenter
  2010-08-14  2:40 ` Vikas Chaudhary
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-08-13 21:03 UTC (permalink / raw)
  To: Ravi Anand
  Cc: Vikas Chaudhary, iscsi-driver, James E.J. Bottomley,
	Karen Higgins, linux-scsi, linux-kernel, kernel-janitors

Gcc complains because these variables aren't initialized.

drivers/scsi/qla4xxx/ql4_nx.c: In function ‘qla4_8xxx_get_flash_info’:
drivers/scsi/qla4xxx/ql4_nx.c:1952: warning: ‘fid’ may be used uninitialized in this function
drivers/scsi/qla4xxx/ql4_nx.c:1952: note: ‘fid’ was declared here
drivers/scsi/qla4xxx/ql4_nx.c:1952: warning: ‘mid’ may be used uninitialized in this function
drivers/scsi/qla4xxx/ql4_nx.c:1952: note: ‘mid’ was declared here

It's not a big deal.  We only print the uninitialized value on error
paths when debugging is enabled.  Still it's nice to clean it up and to
stop gcc from grumbling.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index 3e119ae..e443fa6 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -1949,7 +1949,8 @@ qla4_8xxx_get_fdt_info(struct scsi_qla_host *ha)
 	uint16_t cnt, chksum;
 	uint16_t *wptr;
 	struct qla_fdt_layout *fdt;
-	uint16_t mid, fid;
+	uint16_t mid = -1;
+	uint16_t fid = -1;
 	struct ql82xx_hw_data *hw = &ha->hw;
 
 	hw->flash_conf_off = FARX_ACCESS_FLASH_CONF;

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

* RE: [patch] qla4xxx: initialize some variables for gcc
  2010-08-13 21:03 [patch] qla4xxx: initialize some variables for gcc Dan Carpenter
@ 2010-08-14  2:40 ` Vikas Chaudhary
  0 siblings, 0 replies; 2+ messages in thread
From: Vikas Chaudhary @ 2010-08-14  2:40 UTC (permalink / raw)
  To: Dan Carpenter, Ravi Anand
  Cc: Dept_iscsi_driver, James E.J. Bottomley, Karen Higgins,
	linux-scsi, linux-kernel, kernel-janitors

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1842 bytes --]

>-----Original Message-----
>From: Dan Carpenter [mailto:error27@gmail.com]
>Sent: Saturday, August 14, 2010 2:34 AM
>To: Ravi Anand
>Cc: Vikas Chaudhary; Dept_iscsi_driver; James E.J. Bottomley; Karen
>Higgins; linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org; kernel-
>janitors@vger.kernel.org
>Subject: [patch] qla4xxx: initialize some variables for gcc
>
>Gcc complains because these variables aren't initialized.
>
>drivers/scsi/qla4xxx/ql4_nx.c: In function ‘qla4_8xxx_get_flash_info’:
>drivers/scsi/qla4xxx/ql4_nx.c:1952: warning: ‘fid’ may be used
>uninitialized in this function
>drivers/scsi/qla4xxx/ql4_nx.c:1952: note: ‘fid’ was declared here
>drivers/scsi/qla4xxx/ql4_nx.c:1952: warning: ‘mid’ may be used
>uninitialized in this function
>drivers/scsi/qla4xxx/ql4_nx.c:1952: note: ‘mid’ was declared here
>
>It's not a big deal.  We only print the uninitialized value on error
>paths when debugging is enabled.  Still it's nice to clean it up and to
>stop gcc from grumbling.
>
>Signed-off-by: Dan Carpenter <error27@gmail.com>
>
>diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
>index 3e119ae..e443fa6 100644
>--- a/drivers/scsi/qla4xxx/ql4_nx.c
>+++ b/drivers/scsi/qla4xxx/ql4_nx.c
>@@ -1949,7 +1949,8 @@ qla4_8xxx_get_fdt_info(struct scsi_qla_host *ha)
> 	uint16_t cnt, chksum;
> 	uint16_t *wptr;
> 	struct qla_fdt_layout *fdt;
>-	uint16_t mid, fid;
>+	uint16_t mid = -1;
>+	uint16_t fid = -1;
> 	struct ql82xx_hw_data *hw = &ha->hw;
>
> 	hw->flash_conf_off = FARX_ACCESS_FLASH_CONF;

I already submitted patch to fix this warning in following mail thread.
http://marc.info/?l=linux-scsi&m=128152158403853&w=2

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

end of thread, other threads:[~2010-08-14  2:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-13 21:03 [patch] qla4xxx: initialize some variables for gcc Dan Carpenter
2010-08-14  2:40 ` Vikas Chaudhary

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