Skip to contentSkip to conversation

qla4xxx: initialize some variables for gcc

PATCH In review Dan Carpenter 2 participants 2 messages Aug 13, 2010 – Aug 14, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

drivers/scsi/qla4xxx/ql4_nx.c +2 -1
index 3e119ae..e443fa6 100644
@@ -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;
#1 lore raw
Quoted 30 lines

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Saturday, August 14, 2010 2:34 AM
To: Ravi Anand
Cc: Vikas Chaudhary; Dept_iscsi_driver; James E.J. Bottomley; Karen Higgins; [email protected]; [email protected]; kernel- [email protected]
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.

drivers/scsi/qla4xxx/ql4_nx.c +0 -0
index 3e119ae..e443fa6 100644

drivers/scsi/qla4xxx/ql4_nx.c qla4_8xxx_get_fdt_info(struct scsi_qla_host *ha) · line 1956

Quoted 9 lines
drivers/scsi/qla4xxx/ql4_nx.c +2 -1
@@ -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&m8152158403853&w=2

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¤z¹Ş—øÚ�+h®Ïâ�Ø^n‡r¡ö¦zË�ëh™¨è­Ú&£ûàz¿äz¹Ş—ú+€Ê+zf£¢·hšˆ§~†­†Ûiÿÿï�êÿ‘êçz_è®æj:+v‰¨ş)ߣøm