• Arnd Bergmann's avatar
    scsi: qla4xxx: avoid freeing unallocated dma memory · 608f729c
    Arnd Bergmann authored
    Clang -Wuninitialized notices that on is_qla40XX we never allocate any DMA
    memory in get_fw_boot_info() but attempt to free it anyway:
    
    drivers/scsi/qla4xxx/ql4_os.c:5915:7: error: variable 'buf_dma' is used uninitialized whenever 'if' condition is false
          [-Werror,-Wsometimes-uninitialized]
                    if (!(val & 0x07)) {
                        ^~~~~~~~~~~~~
    drivers/scsi/qla4xxx/ql4_os.c:5985:47: note: uninitialized use occurs here
            dma_free_coherent(&ha->pdev->dev, size, buf, buf_dma);
                                                         ^~~~~~~
    drivers/scsi/qla4xxx/ql4_os.c:5915:3: note: remove the 'if' if its condition is always true
                    if (!(val & 0x07)) {
                    ^~~~~~~~~~~~~~~~~~~
    drivers/scsi/qla4xxx/ql4_os.c:5885:20: note: initialize the variable 'buf_dma' to silence this warning
            dma_addr_t buf_dma;
                              ^
                               = 0
    
    Skip the call to dma_free_coherent() here.
    
    Fixes: 2a991c21 ("[SCSI] qla4xxx: Boot from SAN support for open-iscsi")
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    608f729c
ql4_os.c 283 KB