• Arnd Bergmann's avatar
    scsi: qla4xxx: shut up warning for rd_reg_indirect · 860cd9c0
    Arnd Bergmann authored
    The qla4_83xx_rd_reg_indirect() function can fail when it is unable to
    read a register, but not all callers check its return value before using
    the register data, and gcc correctly warns about this:
    
    qla4xxx/ql4_83xx.c: In function 'qla4_83xx_process_reset_template':
    qla4xxx/ql4_83xx.c:1073:36: warning: 'value' may be used uninitialized in this function
         ha->reset_tmplt.array[index++] = value;
                                        ^
    qla4xxx/ql4_83xx.c:1050:11: note: 'value' was declared here
      uint32_t value;
               ^
    qla4xxx/ql4_83xx.c:902:8: warning: 'value' may be used uninitialized in this function
      value &= p_rmw_hdr->test_mask;
            ^
    qla4xxx/ql4_83xx.c:895:11: note: 'value' was declared here
      uint32_t value;
               ^
    In file included from ../include/linux/io.h:25:0,
                     from ../include/linux/pci.h:31,
                     from ../drivers/scsi/qla4xxx/ql4_def.h:16,
                     from ../drivers/scsi/qla4xxx/ql4_83xx.c:10:
    asm/io.h:101:2: warning: 'value' may be used uninitialized in this function
      asm volatile("str %1, %0"
      ^
    qla4xxx/ql4_83xx.c:874:11: note: 'value' was declared here
      uint32_t value;
               ^
    
    Unfortunately, I don't see any helpful way to add proper error handling
    for this case, and the failure scenario for rd_reg seems rather obscure,
    so this bails out and makes the rd_reg accessor set the result to
    0xffffffff so we at least get a predictable value.
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Acked-by: default avatarNilesh Javali <nilesh.javali@qlogic.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    860cd9c0
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
ql4_83xx.c Loading commit data...
ql4_83xx.h Loading commit data...
ql4_attr.c Loading commit data...
ql4_bsg.c Loading commit data...
ql4_bsg.h Loading commit data...
ql4_dbg.c Loading commit data...
ql4_dbg.h Loading commit data...
ql4_def.h Loading commit data...
ql4_fw.h Loading commit data...
ql4_glbl.h Loading commit data...
ql4_init.c Loading commit data...
ql4_inline.h Loading commit data...
ql4_iocb.c Loading commit data...
ql4_isr.c Loading commit data...
ql4_mbx.c Loading commit data...
ql4_nvram.c Loading commit data...
ql4_nvram.h Loading commit data...
ql4_nx.c Loading commit data...
ql4_nx.h Loading commit data...
ql4_os.c Loading commit data...
ql4_version.h Loading commit data...