Skip to contentSkip to conversation

aic94xx: asd_read_flash: Fix uninitialized variable warning

PATCH New Tim Gardner 1 participant 1 message Feb 20, 2013 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 aic94xx: asd_read_flash: Fix uninitialized variable warning

drivers/scsi/aic94xx/aic94xx_sds.c: In function 'asd_read_flash':
drivers/scsi/aic94xx/aic94xx_sds.c:597:21: warning: 'offs' may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/scsi/aic94xx/aic94xx_sds.c:985:6: note: 'offs' was declared here

If asd_find_flash_de() fails, then 'offs' could be used without having been initialized. Set 'offs' to zero which seems like the most reasonable value.

---
 drivers/scsi/aic94xx/aic94xx_sds.c |    1 +
 1 file changed, 1 insertion(+)
drivers/scsi/aic94xx/aic94xx_sds.c +1 -0
index edb43fd..d11b4d7 100644
@@ -1003,6 +1003,7 @@ static int asd_process_ctrl_a_user(struct asd_ha_struct *asd_ha,
 		}
 
 		size = sizeof(struct asd_ctrla_phy_settings);
+		offs = 0;
 		ps = &dflt_ps;
 	}
 
Signature · 1 line
1.7.9.5