Re: [PATCH 07/11] qla2xxx: Avoid side effects when using endianizer macros.

2016-01-27 Thread Hannes Reinecke
On 01/26/2016 06:10 PM, Himanshu Madhani wrote:
> From: Joe Carnuccio 
> 
> Signed-off-by: Joe Carnuccio 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_attr.c   |4 +-
>  drivers/scsi/qla2xxx/qla_dbg.c|  141 
> -
>  drivers/scsi/qla2xxx/qla_init.c   |   16 ++--
>  drivers/scsi/qla2xxx/qla_inline.h |4 +-
>  drivers/scsi/qla2xxx/qla_mbx.c|   16 ++--
>  drivers/scsi/qla2xxx/qla_sup.c|   23 +++---
>  6 files changed, 106 insertions(+), 98 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 07/11] qla2xxx: Avoid side effects when using endianizer macros.

2016-01-26 Thread kbuild test robot
Hi Joe,

[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.5-rc1 next-20160125]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Himanshu-Madhani/qla2xxx-Remove-unneeded-link-offline-message/20160127-015650
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: x86_64-allyesconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/scsi/qla2xxx/qla_dbg.c: In function 'qla25xx_fw_dump':
>> drivers/scsi/qla2xxx/qla_dbg.c:1426:56: warning: right-hand operand of comma 
>> expression has no effect [-Wunused-value]
 for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++, mbx_reg)
   ^

vim +1426 drivers/scsi/qla2xxx/qla_dbg.c

  1410  
  1411  WRT_REG_DWORD(®->iobase_select, 0xB080);
  1412  fw->shadow_reg[8] = htonl(RD_REG_DWORD(®->iobase_sdata));
  1413  
  1414  WRT_REG_DWORD(®->iobase_select, 0xB090);
  1415  fw->shadow_reg[9] = htonl(RD_REG_DWORD(®->iobase_sdata));
  1416  
  1417  WRT_REG_DWORD(®->iobase_select, 0xB0A0);
  1418  fw->shadow_reg[10] = htonl(RD_REG_DWORD(®->iobase_sdata));
  1419  
  1420  /* RISC I/O register. */
  1421  WRT_REG_DWORD(®->iobase_addr, 0x0010);
  1422  fw->risc_io_reg = htonl(RD_REG_DWORD(®->iobase_window));
  1423  
  1424  /* Mailbox registers. */
  1425  mbx_reg = ®->mailbox0;
> 1426  for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++, mbx_reg)
  1427  fw->mailbox_reg[cnt] = htons(RD_REG_WORD(mbx_reg));
  1428  
  1429  /* Transfer sequence registers. */
  1430  iter_reg = fw->xseq_gp_reg;
  1431  iter_reg = qla24xx_read_window(reg, 0xBF00, 16, iter_reg);
  1432  iter_reg = qla24xx_read_window(reg, 0xBF10, 16, iter_reg);
  1433  iter_reg = qla24xx_read_window(reg, 0xBF20, 16, iter_reg);
  1434  iter_reg = qla24xx_read_window(reg, 0xBF30, 16, iter_reg);

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH 07/11] qla2xxx: Avoid side effects when using endianizer macros.

2016-01-26 Thread kbuild test robot
Hi Joe,

[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.5-rc1 next-20160125]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Himanshu-Madhani/qla2xxx-Remove-unneeded-link-offline-message/20160127-015650
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: xtensa-allyesconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   In file included from include/linux/byteorder/big_endian.h:4:0,
from arch/xtensa/include/uapi/asm/byteorder.h:7,
from arch/xtensa/include/asm/bitops.h:23,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from drivers/scsi/qla2xxx/qla_def.h:10,
from drivers/scsi/qla2xxx/qla_mbx.c:7:
   drivers/scsi/qla2xxx/qla_mbx.c: In function 'qla2x00_get_link_status':
>> include/uapi/linux/byteorder/big_endian.h:94:27: warning: passing argument 1 
>> of '__swab32s' makes pointer from integer without a cast
#define __le32_to_cpus(x) __swab32s((x))
  ^
>> include/linux/byteorder/generic.h:112:22: note: in expansion of macro 
>> '__le32_to_cpus'
#define le32_to_cpus __le32_to_cpus
 ^
>> drivers/scsi/qla2xxx/qla_mbx.c:2806:5: note: in expansion of macro 
>> 'le32_to_cpus'
le32_to_cpus(*iter);
^
   In file included from include/linux/swab.h:4:0,
from include/uapi/linux/byteorder/big_endian.h:12,
from include/linux/byteorder/big_endian.h:4,
from arch/xtensa/include/uapi/asm/byteorder.h:7,
from arch/xtensa/include/asm/bitops.h:23,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from drivers/scsi/qla2xxx/qla_def.h:10,
from drivers/scsi/qla2xxx/qla_mbx.c:7:
   include/uapi/linux/swab.h:235:20: note: expected '__u32 *' but argument is 
of type 'uint32_t'
static inline void __swab32s(__u32 *p)
   ^
   In file included from include/linux/byteorder/big_endian.h:4:0,
from arch/xtensa/include/uapi/asm/byteorder.h:7,
from arch/xtensa/include/asm/bitops.h:23,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from drivers/scsi/qla2xxx/qla_def.h:10,
from drivers/scsi/qla2xxx/qla_mbx.c:7:
   drivers/scsi/qla2xxx/qla_mbx.c: In function 'qla24xx_get_isp_stats':
>> include/uapi/linux/byteorder/big_endian.h:94:27: warning: passing argument 1 
>> of '__swab32s' makes pointer from integer without a cast
#define __le32_to_cpus(x) __swab32s((x))
  ^
>> include/linux/byteorder/generic.h:112:22: note: in expansion of macro 
>> '__le32_to_cpus'
#define le32_to_cpus __le32_to_cpus
 ^
   drivers/scsi/qla2xxx/qla_mbx.c:2854:5: note: in expansion of macro 
'le32_to_cpus'
le32_to_cpus(*iter);
^
   In file included from include/linux/swab.h:4:0,
from include/uapi/linux/byteorder/big_endian.h:12,
from include/linux/byteorder/big_endian.h:4,
from arch/xtensa/include/uapi/asm/byteorder.h:7,
from arch/xtensa/include/asm/bitops.h:23,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from drivers/scsi/qla2xxx/qla_def.h:10,
from drivers/scsi/qla2xxx/qla_mbx.c:7:
   include/uapi/linux/swab.h:235:20: note: expected '__u32 *' but argument is 
of type 'uint32_t'
static inline void __swab32s(__u32 *p)
   ^

vim +/le32_to_cpus +2806 drivers/scsi/qla2xxx/qla_mbx.c

  2790  mcp->flags = IOCTL_CMD;
  2791  rval = qla2x00_mailbox_command(vha, mcp);
  2792  
  2793  if (rval == QLA_SUCCESS) {
  2794  if (mcp->mb[0] != MBS_COMMAND_COMPLETE) {
  2795  ql_dbg(ql_dbg_mbx, vha, 0x1085,
  2796  "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
  2797  rval = QLA_FUNCTION_FAILED;
  2798  } else {
  2799  /* Copy over data -- firmware data is LE. */
  2800  ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1086,
  2801  "Done %s.\n", __func__);
  2802  dwords = offsetof(struct link_statistics,
  2803 

[PATCH 07/11] qla2xxx: Avoid side effects when using endianizer macros.

2016-01-26 Thread Himanshu Madhani
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_attr.c   |4 +-
 drivers/scsi/qla2xxx/qla_dbg.c|  141 -
 drivers/scsi/qla2xxx/qla_init.c   |   16 ++--
 drivers/scsi/qla2xxx/qla_inline.h |4 +-
 drivers/scsi/qla2xxx/qla_mbx.c|   16 ++--
 drivers/scsi/qla2xxx/qla_sup.c|   23 +++---
 6 files changed, 106 insertions(+), 98 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index fadce04..4dc06a13 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -272,8 +272,8 @@ qla2x00_sysfs_write_nvram(struct file *filp, struct kobject 
*kobj,
 
iter = (uint32_t *)buf;
chksum = 0;
-   for (cnt = 0; cnt < ((count >> 2) - 1); cnt++)
-   chksum += le32_to_cpu(*iter++);
+   for (cnt = 0; cnt < ((count >> 2) - 1); cnt++, iter++)
+   chksum += le32_to_cpu(*iter);
chksum = ~chksum + 1;
*iter = cpu_to_le32(chksum);
} else {
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index aa6694b..79782c7 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -294,8 +294,8 @@ qla24xx_read_window(struct device_reg_24xx __iomem *reg, 
uint32_t iobase,
 
WRT_REG_DWORD(®->iobase_addr, iobase);
dmp_reg = ®->iobase_window;
-   while (count--)
-   *buf++ = htonl(RD_REG_DWORD(dmp_reg++));
+   for ( ; count--; dmp_reg++)
+   *buf++ = htonl(RD_REG_DWORD(dmp_reg));
 
return buf;
 }
@@ -457,8 +457,8 @@ qla2xxx_read_window(struct device_reg_2xxx __iomem *reg, 
uint32_t count,
 {
uint16_t __iomem *dmp_reg = ®->u.isp2300.fb_cmd;
 
-   while (count--)
-   *buf++ = htons(RD_REG_WORD(dmp_reg++));
+   for ( ; count--; dmp_reg++)
+   *buf++ = htons(RD_REG_WORD(dmp_reg));
 }
 
 static inline void *
@@ -733,16 +733,18 @@ qla2300_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
 
if (rval == QLA_SUCCESS) {
dmp_reg = ®->flash_address;
-   for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++)
-   fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
+   for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++, dmp_reg++)
+   fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg));
 
dmp_reg = ®->u.isp2300.req_q_in;
-   for (cnt = 0; cnt < sizeof(fw->risc_host_reg) / 2; cnt++)
-   fw->risc_host_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
+   for (cnt = 0; cnt < sizeof(fw->risc_host_reg) / 2;
+   cnt++, dmp_reg++)
+   fw->risc_host_reg[cnt] = htons(RD_REG_WORD(dmp_reg));
 
dmp_reg = ®->u.isp2300.mailbox0;
-   for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++)
-   fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
+   for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2;
+   cnt++, dmp_reg++)
+   fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg));
 
WRT_REG_WORD(®->ctrl_status, 0x40);
qla2xxx_read_window(reg, 32, fw->resp_dma_reg);
@@ -752,8 +754,9 @@ qla2300_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
 
WRT_REG_WORD(®->ctrl_status, 0x00);
dmp_reg = ®->risc_hw;
-   for (cnt = 0; cnt < sizeof(fw->risc_hdw_reg) / 2; cnt++)
-   fw->risc_hdw_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
+   for (cnt = 0; cnt < sizeof(fw->risc_hdw_reg) / 2;
+   cnt++, dmp_reg++)
+   fw->risc_hdw_reg[cnt] = htons(RD_REG_WORD(dmp_reg));
 
WRT_REG_WORD(®->pcr, 0x2000);
qla2xxx_read_window(reg, 16, fw->risc_gp0_reg);
@@ -896,25 +899,25 @@ qla2100_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
}
if (rval == QLA_SUCCESS) {
dmp_reg = ®->flash_address;
-   for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++)
-   fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
+   for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++, dmp_reg++)
+   fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg));
 
dmp_reg = ®->u.isp2100.mailbox0;
-   for (cnt = 0; cnt < ha->mbx_count; cnt++) {
+   for (cnt = 0; cnt < ha->mbx_count; cnt++, dmp_reg++) {
if (cnt == 8)
dmp_reg = ®->u_end.isp2200.mailbox8;
 
-   fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
+   fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg));
}
 
dmp_reg = ®->u.isp2100.unused_2[0];