diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index 8966d3a2b..d047c5c7e 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -6588,8 +6588,7 @@ static ssize_t q2t_show_expl_conf_enabled(struct kobject *kobj, res = scnprintf(buffer, PAGE_SIZE, "%d\n%s", vha->hw->enable_explicit_conf, - vha->hw->enable_explicit_conf ? - SCST_SYSFS_KEY_MARK "\n" : ""); + vha->hw->enable_explicit_conf ? SCST_SYSFS_KEY_MARK "\n" : ""); out: return res; diff --git a/qla2x00t/qla_os.c b/qla2x00t/qla_os.c index 6772523be..b9a07695d 100644 --- a/qla2x00t/qla_os.c +++ b/qla2x00t/qla_os.c @@ -3972,10 +3972,9 @@ void qla2x00_relogin(struct scsi_qla_host *vha) if (fcport->flags & FCF_FCP2_DEVICE) opts |= BIT_1; - status2 = - qla2x00_get_port_database( - vha, fcport, - opts); + status2 = + qla2x00_get_port_database( + vha, fcport, opts); if (status2 != QLA_SUCCESS) status = 1; } diff --git a/scst/include/scst.h b/scst/include/scst.h index 2a438c210..83948c475 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -3963,6 +3963,12 @@ static inline bool scst_cmd_atomic(struct scst_cmd *cmd) return res; } +/* Returns TRUE if cmd completed with SAM_STAT_GOOD */ +static inline bool scst_cmd_completed_good(struct scst_cmd *cmd) +{ + return cmd->completed && (cmd->status == SAM_STAT_GOOD); +} + /* * Returns TRUE if cmd has been preliminary completed, i.e. completed or * aborted. diff --git a/scst/src/dev_handlers/scst_disk.c b/scst/src/dev_handlers/scst_disk.c index 553e4657e..974e01bd1 100644 --- a/scst/src/dev_handlers/scst_disk.c +++ b/scst/src/dev_handlers/scst_disk.c @@ -499,8 +499,7 @@ split: rc = scst_scsi_exec_async(cmd, &work, disk_cmd_done); if (unlikely(rc != 0)) { - PRINT_ERROR("scst_scsi_exec_async() failed: %d", - rc); + PRINT_ERROR("scst_scsi_exec_async() failed: %d", rc); goto out_err_restore; } diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index e6eb7aad6..68e8617b2 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -9473,8 +9473,7 @@ static ssize_t vdev_dif_filename_show(struct kobject *kobj, virt_dev = dev->dh_priv; pos = sprintf(buf, "%s\n%s", virt_dev->dif_filename, - (virt_dev->dif_filename != NULL) ? - SCST_SYSFS_KEY_MARK "\n" : ""); + (virt_dev->dif_filename != NULL) ? SCST_SYSFS_KEY_MARK "\n" : ""); TRACE_EXIT_RES(pos); return pos; diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index a2d4c0900..dc9c8f623 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -10966,19 +10966,15 @@ int scst_block_generic_dev_done(struct scst_cmd *cmd, void (*set_block_shift)(struct scst_cmd *cmd, int block_shift)) { int opcode = cmd->cdb[0]; - int status = cmd->status; int res = SCST_CMD_STATE_DEFAULT; int sect_sz_off; TRACE_ENTRY(); - /* Do not call this function for aborted commands. */ - WARN_ON_ONCE(!cmd->completed); - if (unlikely(opcode == READ_CAPACITY || (opcode == SERVICE_ACTION_IN_16 && cmd->cdb[1] == SAI_READ_CAPACITY_16))) { - if ((status == SAM_STAT_GOOD) || (status == SAM_STAT_CONDITION_MET)) { + if (scst_cmd_completed_good(cmd)) { /* Always keep track of disk capacity */ int buffer_size, sector_size, sh; uint8_t *buffer; @@ -11032,10 +11028,7 @@ int scst_tape_generic_dev_done(struct scst_cmd *cmd, TRACE_ENTRY(); - /* Do not call this function for aborted commands. */ - WARN_ON_ONCE(!cmd->completed); - - if (unlikely(cmd->status != SAM_STAT_GOOD)) + if (unlikely(!scst_cmd_completed_good(cmd))) goto out; switch (opcode) { diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 96289bad4..f5b7eb101 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -3591,7 +3591,7 @@ next: goto out; } - if (likely(cmd->status == SAM_STAT_GOOD)) { + if (likely(scst_cmd_completed_good(cmd))) { if (cmd->deferred_dif_read_check) { int rc = scst_dif_process_read(cmd); if (unlikely(rc != 0)) { @@ -3791,9 +3791,8 @@ static int scst_dev_done(struct scst_cmd *cmd) state = SCST_CMD_STATE_PRE_XMIT_RESP1; - if (likely(cmd->completed && - !(cmd->op_flags & SCST_FULLY_LOCAL_CMD) && - devt->dev_done)) { + if (likely((cmd->op_flags & SCST_FULLY_LOCAL_CMD) == 0) && + likely(devt->dev_done != NULL)) { int rc; if (unlikely(!devt->dev_done_atomic && @@ -4463,8 +4462,8 @@ static int scst_translate_lun(struct scst_cmd *cmd) scst_put(cmd->cpu_cmd_counter); } } else { - TRACE_MGMT_DBG("%s", "FLAG SUSPENDED set, skipping"); scst_put(cmd->cpu_cmd_counter); + TRACE_MGMT_DBG("%s", "FLAG SUSPENDED set, skipping"); res = 1; } @@ -5061,8 +5060,8 @@ static int scst_get_mgmt(struct scst_mgmt_cmd *mcmd) if (unlikely(test_bit(SCST_FLAG_SUSPENDED, &scst_flags) && !test_bit(SCST_FLAG_SUSPENDING, &scst_flags))) { - TRACE_MGMT_DBG("%s", "FLAG SUSPENDED set, skipping"); scst_put(mcmd->cpu_cmd_counter); + TRACE_MGMT_DBG("%s", "FLAG SUSPENDED set, skipping"); res = 1; goto out; }