Skip to contentSkip to conversation

drivers/scsi/hptiop.c: fix build warning

PATCH In review [email protected] 2 participants 2 messages Mar 28, 2008 – Mar 30, 2008

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

PATCH 14/17 drivers/scsi/hptiop.c: fix build warning

From: Andrew Morton <[email protected]>

powerpc:

drivers/scsi/hptiop.c: In function 'iop_set_config_mv':
drivers/scsi/hptiop.c:395: warning: large integer implicitly truncated to unsigned type

This field is only 32-bit, so cpu_to_le64() seems wrong.

Cc HighPoint Linux Team <[email protected]>
Cc James Bottomley <[email protected]>
Cc FUJITA Tomonori <[email protected]>

---

 drivers/scsi/hptiop.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hptiop.c renamed from drivers/scsi/hptiop.c~drivers-scsi-hptiopc-fix-build-warning +1 -1
diff -puN drivers/scsi/hptiop.c~drivers-scsi-hptiopc-fix-build-warning drivers/scsi/hptiop.c
@@ -392,7 +392,7 @@ static int iop_set_config_mv(struct hpti
 	req->header.size =
 		cpu_to_le32(sizeof(struct hpt_iop_request_set_config));
 	req->header.result = cpu_to_le32(IOP_RESULT_PENDING);
-	req->header.context = cpu_to_le64(IOP_REQUEST_TYPE_SET_CONFIG<<5);
+	req->header.context = cpu_to_le32(IOP_REQUEST_TYPE_SET_CONFIG<<5);
 
 	if (iop_send_sync_request_mv(hba, 0, 20000)) {
 		dprintk("Set config send cmd failed\n");

_

maintainer
#1 lore raw
Quoted 22 lines · On Fri, 2008-03-28 at 14:48 -0700, [email protected] wrote:

From: Andrew Morton <[email protected]>

powerpc:

drivers/scsi/hptiop.c: In function 'iop_set_config_mv':
drivers/scsi/hptiop.c:395: warning: large integer implicitly truncated to unsigned type

This field is only 32-bit, so cpu_to_le64() seems wrong.

Cc HighPoint Linux Team <[email protected]>
Cc James Bottomley <[email protected]>
Cc FUJITA Tomonori <[email protected]>

---

 drivers/scsi/hptiop.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/scsi/hptiop.c~drivers-scsi-hptiopc-fix-build-warning drivers/scsi/hptiop.c

drivers/scsi/hptiop.c static int iop_set_config_mv(struct hpti · line 398

Quoted 8 lines
drivers/scsi/hptiop.c renamed from drivers/scsi/hptiop.c~drivers-scsi-hptiopc-fix-build-warning +1 -1
@@ -392,7 +392,7 @@ static int iop_set_config_mv(struct hpti
 	req->header.size =
 		cpu_to_le32(sizeof(struct hpt_iop_request_set_config));
 	req->header.result = cpu_to_le32(IOP_RESULT_PENDING);
-	req->header.context = cpu_to_le64(IOP_REQUEST_TYPE_SET_CONFIG<<5);
+	req->header.context = cpu_to_le32(IOP_REQUEST_TYPE_SET_CONFIG<<5);
 
 	if (iop_send_sync_request_mv(hba, 0, 20000)) {
 		dprintk("Set config send cmd failed\n");

I'm curious to know why the identical statement in iop_get_config_mv() doesn't trigger any warnings.

Regardless, the usage of this field is 64 bits; it's just split high and low, so the correct fix is to do the le32 for the low field and to zero out the high one.

Fortunately, I suspect nothing ever sets the high field, so it's probably accidentally zero most of the time.

Can I get an ack for this (or a better fix) from the highpoint team?

James

---

drivers/scsi/hptiop.c +4 -2
index 44dccf2..beecda9 100644
@@ -338,7 +338,8 @@ static int iop_get_config_mv(struct hptiop_hba *hba,
 	req->header.size =
 		cpu_to_le32(sizeof(struct hpt_iop_request_get_config));
 	req->header.result = cpu_to_le32(IOP_RESULT_PENDING);
-	req->header.context = cpu_to_le64(IOP_REQUEST_TYPE_GET_CONFIG<<5);
+	req->header.context = cpu_to_le32(IOP_REQUEST_TYPE_GET_CONFIG<<5);
+	req->header.context_hi32 = 0;
 
 	if (iop_send_sync_request_mv(hba, 0, 20000)) {
 		dprintk("Get config send cmd failed\n");
@@ -392,7 +393,8 @@ static int iop_set_config_mv(struct hptiop_hba *hba,
 	req->header.size =
 		cpu_to_le32(sizeof(struct hpt_iop_request_set_config));
 	req->header.result = cpu_to_le32(IOP_RESULT_PENDING);
-	req->header.context = cpu_to_le64(IOP_REQUEST_TYPE_SET_CONFIG<<5);
+	req->header.context = cpu_to_le32(IOP_REQUEST_TYPE_SET_CONFIG<<5);
+	req->header.context_hi32 = 0;
 
 	if (iop_send_sync_request_mv(hba, 0, 20000)) {
 		dprintk("Set config send cmd failed\n");