diff mbox

qla2xxx: Fix compile warning

Message ID 20170628220026.5706-1-himanshu.madhani@cavium.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Madhani, Himanshu June 28, 2017, 10 p.m. UTC
Fixes following warning

drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2x00_start_nvme_mq':
include/uapi/linux/byteorder/big_endian.h:32:26: warning: large integer
implicitly truncated to unsigned type [-Woverflow]
 #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))

Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
---
 drivers/scsi/qla2xxx/qla_nvme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Bottomley June 28, 2017, 10:12 p.m. UTC | #1
On Wed, 2017-06-28 at 15:00 -0700, Himanshu Madhani wrote:
> Fixes following warning
> 
> drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2x00_start_nvme_mq':
> include/uapi/linux/byteorder/big_endian.h:32:26: warning: large
> integer
> implicitly truncated to unsigned type [-Woverflow]
>  #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
> 
> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
> ---
>  drivers/scsi/qla2xxx/qla_nvme.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_nvme.c
> b/drivers/scsi/qla2xxx/qla_nvme.c
> index 1da8fa8f641d..14e25e32e622 100644
> --- a/drivers/scsi/qla2xxx/qla_nvme.c
> +++ b/drivers/scsi/qla2xxx/qla_nvme.c
> @@ -441,7 +441,7 @@ static int qla2x00_start_nvme_mq(srb_t *sp)
>  				req->ring_ptr++;
>  			}
>  			cont_pkt = (cont_a64_entry_t *)req-
> >ring_ptr;
> -			cont_pkt->entry_type =
> cpu_to_le32(CONTINUE_A64_TYPE);
> +			cont_pkt->entry_type = CONTINUE_A64_TYPE;


Well the code is definitely buggy, because it will load 0 on a BE
system.  However, are you sure this is the right fix?  I thought the
qlogic engine did groups of 32 bit words, which is why the pre-nvme
code loads this field as:

	*((uint32_t *)(&cont_pkt->entry_type)) = cpu_to_le32(CONTINUE_TYPE);

James
Madhani, Himanshu June 28, 2017, 11:03 p.m. UTC | #2
> On Jun 28, 2017, at 3:12 PM, James Bottomley <James.Bottomley@HansenPartnership.com> wrote:

> 

> On Wed, 2017-06-28 at 15:00 -0700, Himanshu Madhani wrote:

>> Fixes following warning

>> 

>> drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2x00_start_nvme_mq':

>> include/uapi/linux/byteorder/big_endian.h:32:26: warning: large

>> integer

>> implicitly truncated to unsigned type [-Woverflow]

>>  #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))

>> 

>> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>

>> ---

>>  drivers/scsi/qla2xxx/qla_nvme.c | 2 +-

>>  1 file changed, 1 insertion(+), 1 deletion(-)

>> 

>> diff --git a/drivers/scsi/qla2xxx/qla_nvme.c

>> b/drivers/scsi/qla2xxx/qla_nvme.c

>> index 1da8fa8f641d..14e25e32e622 100644

>> --- a/drivers/scsi/qla2xxx/qla_nvme.c

>> +++ b/drivers/scsi/qla2xxx/qla_nvme.c

>> @@ -441,7 +441,7 @@ static int qla2x00_start_nvme_mq(srb_t *sp)

>>  				req->ring_ptr++;

>>  			}

>>  			cont_pkt = (cont_a64_entry_t *)req-

>>> ring_ptr;

>> -			cont_pkt->entry_type =

>> cpu_to_le32(CONTINUE_A64_TYPE);

>> +			cont_pkt->entry_type = CONTINUE_A64_TYPE;

>>  

> 

> Well the code is definitely buggy, because it will load 0 on a BE

> system.  However, are you sure this is the right fix?  I thought the

> qlogic engine did groups of 32 bit words, which is why the pre-nvme

> code loads this field as:

> 

> 	*((uint32_t *)(&cont_pkt->entry_type)) = cpu_to_le32(CONTINUE_TYPE);

> 

> James


Agree. I need to go back and check which would be right fix. 

Once i’ve confirmed it works on both platform, I’ll send out new patch.

Thanks,
- Himanshu
diff mbox

Patch

diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index 1da8fa8f641d..14e25e32e622 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -441,7 +441,7 @@  static int qla2x00_start_nvme_mq(srb_t *sp)
 				req->ring_ptr++;
 			}
 			cont_pkt = (cont_a64_entry_t *)req->ring_ptr;
-			cont_pkt->entry_type = cpu_to_le32(CONTINUE_A64_TYPE);
+			cont_pkt->entry_type = CONTINUE_A64_TYPE;
 
 			cur_dsd = (uint32_t *)cont_pkt->dseg_0_address;
 			avail_dsds = 5;