aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/megaraid.c
diff options
context:
space:
mode:
authoradam radford <aradford@gmail.com>2012-01-10 21:07:56 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-01-16 03:28:03 -0500
commit124dd90f6525ee785b47b59aebadd4a35f797dc1 (patch)
treede46f5d335a05c198567ae3d7b2a9a212fd04006 /drivers/scsi/megaraid.c
parent7e95fffe080d4dbe826dfe864eb084916cdc6468 (diff)
[SCSI] megaraid: fix sparse warnings
There's a zero day mistake in the megaraid driver in that the code that obtains the version number does a >> 8 on a char quantity. This >>8 causes a sparse warning because it always produces zero. Al Viro suggested these shifts should be >> 4 thus treating the firmware version as a BCD quantity. However, in the interests of safety we've elected to replace the >> 8 quantities with an explicit zero, thus quieting the sparse warning while preserving the same (albeit incorrect) version number as had previously been seen. Signed-off-by: Adam Radford <aradford@gmail.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/megaraid.c')
-rw-r--r--drivers/scsi/megaraid.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 5c1776406c96..15eefa1d61fd 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -306,19 +306,22 @@ mega_query_adapter(adapter_t *adapter)
306 adapter->host->sg_tablesize = adapter->sglen; 306 adapter->host->sg_tablesize = adapter->sglen;
307 307
308 308
309 /* use HP firmware and bios version encoding */ 309 /* use HP firmware and bios version encoding
310 Note: fw_version[0|1] and bios_version[0|1] were originally shifted
311 right 8 bits making them zero. This 0 value was hardcoded to fix
312 sparse warnings. */
310 if (adapter->product_info.subsysvid == HP_SUBSYS_VID) { 313 if (adapter->product_info.subsysvid == HP_SUBSYS_VID) {
311 sprintf (adapter->fw_version, "%c%d%d.%d%d", 314 sprintf (adapter->fw_version, "%c%d%d.%d%d",
312 adapter->product_info.fw_version[2], 315 adapter->product_info.fw_version[2],
313 adapter->product_info.fw_version[1] >> 8, 316 0,
314 adapter->product_info.fw_version[1] & 0x0f, 317 adapter->product_info.fw_version[1] & 0x0f,
315 adapter->product_info.fw_version[0] >> 8, 318 0,
316 adapter->product_info.fw_version[0] & 0x0f); 319 adapter->product_info.fw_version[0] & 0x0f);
317 sprintf (adapter->bios_version, "%c%d%d.%d%d", 320 sprintf (adapter->bios_version, "%c%d%d.%d%d",
318 adapter->product_info.bios_version[2], 321 adapter->product_info.bios_version[2],
319 adapter->product_info.bios_version[1] >> 8, 322 0,
320 adapter->product_info.bios_version[1] & 0x0f, 323 adapter->product_info.bios_version[1] & 0x0f,
321 adapter->product_info.bios_version[0] >> 8, 324 0,
322 adapter->product_info.bios_version[0] & 0x0f); 325 adapter->product_info.bios_version[0] & 0x0f);
323 } else { 326 } else {
324 memcpy(adapter->fw_version, 327 memcpy(adapter->fw_version,