Skip to content
  1. Oct 18, 2018
  2. Oct 17, 2018
    • YueHaibing's avatar
      scsi: lpfc: Remove set but not used variables 'tgtp' · d021613e
      YueHaibing authored
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/scsi/lpfc/lpfc_debugfs.c: In function 'lpfc_debugfs_nodelist_data':
      drivers/scsi/lpfc/lpfc_debugfs.c:553:29: warning:
       variable 'tgtp' set but not used [-Wunused-but-set-variable]
      
      It never used since 2b65e182
      
       ("scsi: lpfc: NVME Target: Add debugfs support")
      
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      d021613e
    • Gustavo A. R. Silva's avatar
      scsi: aic94xx: mark expected switch fall-throughs · 6940d12b
      Gustavo A. R. Silva authored
      
      
      In preparation to enabling -Wimplicit-fallthrough, mark switch cases
      where we are expecting to fall through.
      
      Addresses-Coverity-ID: 114988 ("Missing break in switch")
      Addresses-Coverity-ID: 114989 ("Missing break in switch")
      Addresses-Coverity-ID: 114990 ("Missing break in switch")
      Addresses-Coverity-ID: 114991 ("Missing break in switch")
      Addresses-Coverity-ID: 114992 ("Missing break in switch")
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      6940d12b
    • Nathan Chancellor's avatar
      scsi: iscsi_tcp: Explicitly cast param in iscsi_sw_tcp_host_get_param · 20054597
      Nathan Chancellor authored
      Clang warns when one enumerated type is implicitly converted to another.
      
      drivers/scsi/iscsi_tcp.c:803:15: warning: implicit conversion from
      enumeration type 'enum iscsi_host_param' to different enumeration type
      'enum iscsi_param' [-Wenum-conversion]
                                                       &addr, param, buf);
                                                              ^~~~~
      1 warning generated.
      
      iscsi_conn_get_addr_param handles ISCSI_HOST_PARAM_IPADDRESS just fine
      so add an explicit cast to iscsi_param to make it clear to Clang that
      this is expected behavior.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/153
      
      
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      20054597
    • YueHaibing's avatar
      scsi: lpfc: Remove set but not used variable 'psli' · f41d84d4
      YueHaibing authored
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/scsi/lpfc/lpfc_hbadisc.c: In function 'lpfc_free_tx':
      drivers/scsi/lpfc/lpfc_hbadisc.c:5431:19: warning:
       variable 'psli' set but not used [-Wunused-but-set-variable]
      
      Since commit 895427bd
      
       ("scsi: lpfc: NVME Initiator: Base modifications")
      'psli' is not used any more.
      
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      f41d84d4
    • Nathan Chancellor's avatar
      scsi: bfa: Avoid implicit enum conversion in bfad_im_post_vendor_event · 761c830e
      Nathan Chancellor authored
      Clang warns when one enumerated type is implicitly converted to another.
      
      drivers/scsi/bfa/bfa_fcs_lport.c:379:26: warning: implicit conversion
      from enumeration type 'enum bfa_lport_aen_event' to different
      enumeration type 'enum bfa_ioc_aen_event' [-Wenum-conversion]
                                        BFA_AEN_CAT_LPORT, event);
                                                           ^~~~~
      
      The root cause of these warnings is the bfad_im_post_vendor_event
      function, which expects a value from enum bfa_ioc_aen_event but there
      are multiple instances of values from enums bfa_port_aen_event,
      bfa_audit_aen_event, and bfa_lport_aen_event being used in this
      function.
      
      Given that this doesn't appear to be a problem since cat helps with
      differentiating the events, just change evt's type to int so that no
      conversion needs to happen and Clang won't warn. Update aen_type's type
      in bfa_aen_entry_s as members that hold enumerated types should be int.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/147
      
      
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      761c830e
    • Nathan Chancellor's avatar
      scsi: isci: Change sci_controller_start_task's return type to sci_status · 362b5da3
      Nathan Chancellor authored
      Clang warns when an enumerated type is implicitly converted to another.
      
      drivers/scsi/isci/request.c:3476:13: warning: implicit conversion from
      enumeration type 'enum sci_task_status' to different enumeration type
      'enum sci_status' [-Wenum-conversion]
                              status = sci_controller_start_task(ihost,
                                     ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/scsi/isci/host.c:2744:10: warning: implicit conversion from
      enumeration type 'enum sci_status' to different enumeration type 'enum
      sci_task_status' [-Wenum-conversion]
                      return SCI_SUCCESS;
                      ~~~~~~ ^~~~~~~~~~~
      drivers/scsi/isci/host.c:2753:9: warning: implicit conversion from
      enumeration type 'enum sci_status' to different enumeration type 'enum
      sci_task_status' [-Wenum-conversion]
              return status;
              ~~~~~~ ^~~~~~
      
      Avoid all of these implicit conversion by just making
      sci_controller_start_task use sci_status. This silences
      Clang and has no functional change since sci_task_status
      has all of its values mapped to something in sci_status.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/153
      
      
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      362b5da3
    • Nathan Chancellor's avatar
      scsi: isci: Use proper enumerated type in atapi_d2h_reg_frame_handler · e9e9a103
      Nathan Chancellor authored
      Clang warns when one enumerated type is implicitly converted to another.
      
      drivers/scsi/isci/request.c:1629:13: warning: implicit conversion from
      enumeration type 'enum sci_io_status' to different enumeration type
      'enum sci_status' [-Wenum-conversion]
                              status = SCI_IO_FAILURE_RESPONSE_VALID;
                                     ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/scsi/isci/request.c:1631:12: warning: implicit conversion from
      enumeration type 'enum sci_io_status' to different enumeration type
      'enum sci_status' [-Wenum-conversion]
                      status = SCI_IO_FAILURE_RESPONSE_VALID;
                             ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      status is of type sci_status but SCI_IO_FAILURE_RESPONSE_VALID is of
      type sci_io_status. Use SCI_FAILURE_IO_RESPONSE_VALID, which is from
      sci_status and has SCI_IO_FAILURE_RESPONSE_VALID's exact value since
      that is what SCI_IO_FAILURE_RESPONSE_VALID is mapped to in the isci.h
      file.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/153
      
      
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      e9e9a103
    • YueHaibing's avatar
      scsi: lpfc: Remove set but not used variables 'fc_hdr' and 'hw_page_size' · feb59a34
      YueHaibing authored
      
      
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/scsi/lpfc/lpfc_sli.c: In function 'lpfc_sli4_sp_handle_rcqe':
      drivers/scsi/lpfc/lpfc_sli.c:13430:26: warning:
       variable 'fc_hdr' set but not used [-Wunused-but-set-variable]
      
      drivers/scsi/lpfc/lpfc_sli.c: In function 'lpfc_cq_create':
      drivers/scsi/lpfc/lpfc_sli.c:14852:11: warning:
       variable 'hw_page_size' set but not used [-Wunused-but-set-variable]
      
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      feb59a34
    • Varun Prakash's avatar
      scsi: cxgb4i: add DCB support for iSCSI connections · b5a5fe4e
      Varun Prakash authored
      
      
      Add IEEE and CEE DCBX support for iSCSI connections.
      
      Signed-off-by: default avatarRohit Maheshwari <rohitm@chelsio.com>
      Signed-off-by: default avatarVarun Prakash <varun@chelsio.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      b5a5fe4e
    • YueHaibing's avatar
      scsi: megaraid_mbox: remove set but not used variables · 13eb34b6
      YueHaibing authored
      
      
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/scsi/megaraid/megaraid_mbox.c: In function 'megaraid_reset_handler':
      drivers/scsi/megaraid/megaraid_mbox.c:2580:7: warning:
       variable 'recovering' set but not used [-Wunused-but-set-variable]
      
      drivers/scsi/megaraid/megaraid_mbox.c: In function 'mbox_post_sync_cmd':
      drivers/scsi/megaraid/megaraid_mbox.c:2728:12: warning:
       variable 'mbox64' set but not used [-Wunused-but-set-variable]
      
      drivers/scsi/megaraid/megaraid_mbox.c: In function 'megaraid_mbox_support_random_del':
      drivers/scsi/megaraid/megaraid_mbox.c:3138:11: warning:
       variable 'mbox' set but not used [-Wunused-but-set-variable]
      
      drivers/scsi/megaraid/megaraid_mbox.c: In function 'megaraid_mbox_flush_cache':
      drivers/scsi/megaraid/megaraid_mbox.c:3266:10: warning:
       variable 'mbox' set but not used [-Wunused-but-set-variable]
      
      drivers/scsi/megaraid/megaraid_mbox.c: In function 'megaraid_mbox_fire_sync_cmd':
      drivers/scsi/megaraid/megaraid_mbox.c:3302:12: warning:
       variable 'mbox64' set but not used [-Wunused-but-set-variable]
      
      drivers/scsi/megaraid/megaraid_mbox.c: In function 'gather_hbainfo':
      drivers/scsi/megaraid/megaraid_mbox.c:3797:10: warning:
       variable 'dmajor' set but not used [-Wunused-but-set-variable]
      
      [mkp: applied by hand due to conflict with hch's DMA cleanup]
      
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      13eb34b6
    • Nathan Chancellor's avatar
      scsi: qla2xxx: Simplify conditional check · 0bfe7d3c
      Nathan Chancellor authored
      Clang generates a warning when it sees a logical not followed by a
      conditional operator like ==, >, or < because it thinks that the logical
      not should be applied to the whole statement:
      
      drivers/scsi/qla2xxx/qla_nx.c:3702:7: warning: logical not is only
      applied to the left hand side of this comparison
      [-Wlogical-not-parentheses]
                      if (!qla2x00_eh_wait_for_pending_commands(vha, 0, 0,
                          ^
      drivers/scsi/qla2xxx/qla_nx.c:3702:7: note: add parentheses after the
      '!' to evaluate the comparison first
                      if (!qla2x00_eh_wait_for_pending_commands(vha, 0, 0,
                          ^
                           (
      drivers/scsi/qla2xxx/qla_nx.c:3702:7: note: add parentheses around left
      hand side expression to silence this warning
                      if (!qla2x00_eh_wait_for_pending_commands(vha, 0, 0,
                          ^
                          (
      1 warning generated.
      
      It assumes the author might have made a mistake in their logic:
      
      if (!a == b) -> if (!(a == b))
      
      Sometimes that is the case; other times, it's just a super convoluted
      way of saying 'if (a)' when b = 0:
      
      if (!1 == 0) -> if (0 == 0) -> if (true)
      
      Alternatively:
      
      if (!1 == 0) -> if (!!1) -> if (1)
      
      Simplify this comparison so that Clang doesn't complain.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/80
      
      
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      0bfe7d3c
    • Nathan Chancellor's avatar
      scsi: bfa: Remove unused functions · 6498cbc5
      Nathan Chancellor authored
      Clang warns when a variable is assigned to itself.
      
      drivers/scsi/bfa/bfa_fcbuild.c:199:6: warning: explicitly assigning
      value of variable of type 'int' to itself [-Wself-assign]
              len = len;
              ~~~ ^ ~~~
      drivers/scsi/bfa/bfa_fcbuild.c:838:6: warning: explicitly assigning
      value of variable of type 'int' to itself [-Wself-assign]
              len = len;
              ~~~ ^ ~~~
      drivers/scsi/bfa/bfa_fcbuild.c:917:6: warning: explicitly assigning
      value of variable of type 'int' to itself [-Wself-assign]
              len = len;
              ~~~ ^ ~~~
      drivers/scsi/bfa/bfa_fcbuild.c:981:6: warning: explicitly assigning
      value of variable of type 'int' to itself [-Wself-assign]
              len = len;
              ~~~ ^ ~~~
      drivers/scsi/bfa/bfa_fcbuild.c:1008:6: warning: explicitly assigning
      value of variable of type 'int' to itself [-Wself-assign]
              len = len;
              ~~~ ^ ~~~
      5 warnings generated.
      
      This construct is usually used to avoid unused variable warnings, which
      I assume is the case here. -Wunused-parameter is hidden behind -Wextra
      with GCC 4.6, which is the minimum version to compile the kernel as of
      commit cafa0010 ("Raise the minimum required gcc version to 4.6").
      
      However, upon further inspection, these functions aren't actually used
      anywhere; they're just defined. Rather than just removing the self
      assignments, remove all of this dead code.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/148
      
      
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      6498cbc5