Skip to contentSkip to conversation

drivers/scsi/megaraid.c: fix sparse warnings

PATCH In review [email protected] 2 participants 2 messages May 23, 2011 – May 24, 2011

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

PATCH 5/6 drivers/scsi/megaraid.c: fix sparse warnings

From: Randy Dunlap <[email protected]>

Fix sparse warnings of right shift bigger than source value size:

drivers/scsi/megaraid.c:311:65: warning: right shift by bigger than source value drivers/scsi/megaraid.c:313:65: warning: right shift by bigger than source value drivers/scsi/megaraid.c:317:67: warning: right shift by bigger than source value drivers/scsi/megaraid.c:319:67: warning: right shift by bigger than source value

Patch suggestion from email by Al Viro:

"Since both are claimed to be strings, I really suspect that this >> 8 is misspelled >> 4 and they have a character followed by pair of two-digit packed decimals in there..."

Cc Al Viro <[email protected]>
Cc Neela Syam Kolli <[email protected]>
Cc James Bottomley <[email protected]>

---

 drivers/scsi/megaraid.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/megaraid.c renamed from drivers/scsi/megaraid.c~drivers-scsi-megaraidc-fix-sparse-warnings +4 -4
diff -puN drivers/scsi/megaraid.c~drivers-scsi-megaraidc-fix-sparse-warnings drivers/scsi/megaraid.c
@@ -310,15 +310,15 @@ mega_query_adapter(adapter_t *adapter)
 	if (adapter->product_info.subsysvid == HP_SUBSYS_VID) {
 		sprintf (adapter->fw_version, "%c%d%d.%d%d",
 			 adapter->product_info.fw_version[2],
-			 adapter->product_info.fw_version[1] >> 8,
+			 adapter->product_info.fw_version[1] >> 4,
 			 adapter->product_info.fw_version[1] & 0x0f,
-			 adapter->product_info.fw_version[0] >> 8,
+			 adapter->product_info.fw_version[0] >> 4,
 			 adapter->product_info.fw_version[0] & 0x0f);
 		sprintf (adapter->bios_version, "%c%d%d.%d%d",
 			 adapter->product_info.bios_version[2],
-			 adapter->product_info.bios_version[1] >> 8,
+			 adapter->product_info.bios_version[1] >> 4,
 			 adapter->product_info.bios_version[1] & 0x0f,
-			 adapter->product_info.bios_version[0] >> 8,
+			 adapter->product_info.bios_version[0] >> 4,
 			 adapter->product_info.bios_version[0] & 0x0f);
 	} else {
 		memcpy(adapter->fw_version,

_

maintainer
#1 lore raw
Quoted 9 lines · On Mon, 2011-05-23 at 15:29 -0700, [email protected] wrote:

From: Randy Dunlap <[email protected]>

Fix sparse warnings of right shift bigger than source value size:

drivers/scsi/megaraid.c:311:65: warning: right shift by bigger than source value drivers/scsi/megaraid.c:313:65: warning: right shift by bigger than source value drivers/scsi/megaraid.c:317:67: warning: right shift by bigger than source value drivers/scsi/megaraid.c:319:67: warning: right shift by bigger than source value

Quoted 5 lines

Patch suggestion from email by Al Viro:

"Since both are claimed to be strings, I really suspect that this >> 8 is misspelled >> 4 and they have a character followed by pair of two-digit packed decimals in there..."

This looks completely reasonable. Since it alters the way we print the firmware version, could I have an ack from LSI people that nothing will break if we do this?

James

Quoted 38 lines
Cc Al Viro <[email protected]>
Cc Neela Syam Kolli <[email protected]>
Cc James Bottomley <[email protected]>

---

 drivers/scsi/megaraid.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff -puN drivers/scsi/megaraid.c~drivers-scsi-megaraidc-fix-sparse-warnings drivers/scsi/megaraid.c

drivers/scsi/megaraid.c renamed from drivers/scsi/megaraid.c~drivers-scsi-megaraidc-fix-sparse-warnings +4 -4
@@ -310,15 +310,15 @@ mega_query_adapter(adapter_t *adapter)
 	if (adapter->product_info.subsysvid == HP_SUBSYS_VID) {
 		sprintf (adapter->fw_version, "%c%d%d.%d%d",
 			 adapter->product_info.fw_version[2],
-			 adapter->product_info.fw_version[1] >> 8,
+			 adapter->product_info.fw_version[1] >> 4,
 			 adapter->product_info.fw_version[1] & 0x0f,
-			 adapter->product_info.fw_version[0] >> 8,
+			 adapter->product_info.fw_version[0] >> 4,
 			 adapter->product_info.fw_version[0] & 0x0f);
 		sprintf (adapter->bios_version, "%c%d%d.%d%d",
 			 adapter->product_info.bios_version[2],
-			 adapter->product_info.bios_version[1] >> 8,
+			 adapter->product_info.bios_version[1] >> 4,
 			 adapter->product_info.bios_version[1] & 0x0f,
-			 adapter->product_info.bios_version[0] >> 8,
+			 adapter->product_info.bios_version[0] >> 4,
 			 adapter->product_info.bios_version[0] & 0x0f);
 	} else {
 		memcpy(adapter->fw_version,

_
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html