scst: Remove else after a break or return

Remove the else because the if statement has a break or return statement.

This patch fixes the following checkpatch warnings:

    WARNING:UNNECESSARY_ELSE: else is not generally useful after a break
    or return.
This commit is contained in:
Gleb Chesnokov
2022-08-09 19:38:00 +03:00
committed by Gleb Chesnokov
parent ebae8bd223
commit 46ad98f072
8 changed files with 50 additions and 56 deletions
+2 -2
View File
@@ -139,10 +139,10 @@ int digest_rx_header(struct iscsi_cmnd *cmnd)
if (unlikely(crc != cmnd->hdigest)) {
PRINT_ERROR("%s", "RX header digest failed");
return -EIO;
} else {
TRACE_DBG("RX header digest OK for cmd %p", cmnd);
}
TRACE_DBG("RX header digest OK for cmd %p", cmnd);
return 0;
}
+3 -3
View File
@@ -1020,10 +1020,10 @@ void req_add_to_write_timeout_list(struct iscsi_cmnd *req)
&r->write_timeout_list_entry);
inserted = true;
break;
} else {
TRACE_DBG("Skipping op %x req %p (tt %ld)",
cmnd_opcode(r), r, tt);
}
TRACE_DBG("Skipping op %x req %p (tt %ld)",
cmnd_opcode(r), r, tt);
}
if (!inserted) {
TRACE_DBG("Add NOP IN req %p in the tail", req);
+8 -10
View File
@@ -4675,10 +4675,9 @@ static inline uint16_t scst_cmd_get_dif_exp_app_tag(struct scst_cmd *cmd)
#endif
if (cmd->cdb_len == 32)
return get_unaligned_be16(&cmd->cdb[24]);
else {
/* cmd->dev must be alive at this point */
return be16_to_cpu(cmd->dev->dev_dif_static_app_tag);
}
/* cmd->dev must be alive at this point */
return be16_to_cpu(cmd->dev->dev_dif_static_app_tag);
}
/*
@@ -4693,12 +4692,11 @@ static inline uint16_t scst_cmd_get_dif_app_tag_mask(struct scst_cmd *cmd)
#endif
if (cmd->cdb_len == 32)
return get_unaligned_be16(&cmd->cdb[26]);
else {
if (scst_get_dif_checks(cmd->cmd_dif_actions) & SCST_DIF_CHECK_APP_TAG)
return 0xFFFF;
else
return 0;
}
if (scst_get_dif_checks(cmd->cmd_dif_actions) & SCST_DIF_CHECK_APP_TAG)
return 0xFFFF;
return 0;
}
/*
+8 -8
View File
@@ -3182,9 +3182,9 @@ static void fileio_async_complete(struct kiocb *iocb, long ret
w->cmd = cmd;
schedule_work(&w->work);
return;
} else {
scst_set_busy(cmd);
}
scst_set_busy(cmd);
}
cmd->completed = 1;
cmd->scst_cmd_done(cmd, SCST_CMD_STATE_DEFAULT, scst_estimate_context());
@@ -6978,8 +6978,8 @@ static int vdev_parse_add_dev_params(struct scst_vdisk_dev *virt_dev,
}
if (dd == NULL)
break;
else
*dd = '|';
*dd = '|';
d = dd+1;
}
TRACE_DBG("DIF DEV mode %x", virt_dev->dif_mode);
@@ -9007,13 +9007,13 @@ static ssize_t vdev_sysfs_naa_id_store(struct kobject *kobj,
case 2 * 8:
if (strchr("235", buf[0]))
break;
else
goto out;
goto out;
case 2 * 16:
if (strchr("6", buf[0]))
break;
else
goto out;
goto out;
default:
goto out;
}
+5 -5
View File
@@ -1946,12 +1946,12 @@ static struct scst_cm_list_id *scst_cm_add_list_id(struct scst_cmd *cmd,
if (l->cm_list_id_state == SCST_CM_LIST_ID_STATE_PENDING_FREE) {
scst_cm_del_free_list_id(l);
break;
} else {
TRACE_DBG("List id %d already exists", list_id);
scst_set_cmd_error(cmd,
SCST_LOAD_SENSE(scst_sense_operation_in_progress));
goto out_unlock_free;
}
TRACE_DBG("List id %d already exists", list_id);
scst_set_cmd_error(cmd,
SCST_LOAD_SENSE(scst_sense_operation_in_progress));
goto out_unlock_free;
}
}
+18 -22
View File
@@ -3201,11 +3201,11 @@ const char *scst_get_opcode_name(struct scst_cmd *cmd)
{
if (cmd->op_name)
return cmd->op_name;
else {
scnprintf(cmd->not_parsed_op_name,
sizeof(cmd->not_parsed_op_name), "0x%x", cmd->cdb[0]);
return cmd->not_parsed_op_name;
}
scnprintf(cmd->not_parsed_op_name,
sizeof(cmd->not_parsed_op_name), "0x%x", cmd->cdb[0]);
return cmd->not_parsed_op_name;
}
EXPORT_SYMBOL(scst_get_opcode_name);
#endif
@@ -7036,14 +7036,12 @@ static void scst_send_release(struct scst_device *dev)
sense, 15, 0, 0);
TRACE_DBG("RELEASE done: %x", rc);
if (scsi_status_is_good(rc)) {
if (scsi_status_is_good(rc))
break;
} else {
PRINT_ERROR("RELEASE failed: %d", rc);
PRINT_BUFFER("RELEASE sense", sense, sizeof(sense));
scst_check_internal_sense(dev, rc, sense,
sizeof(sense));
}
PRINT_ERROR("RELEASE failed: %d", rc);
PRINT_BUFFER("RELEASE sense", sense, sizeof(sense));
scst_check_internal_sense(dev, rc, sense, sizeof(sense));
}
out:
@@ -11407,13 +11405,12 @@ static int get_cdb_info_read_10(struct scst_cmd *cmd,
if (res != 0)
return res;
else {
#ifdef CONFIG_SCST_DIF_INJECT_CORRUPTED_TAGS
EXTRACHECKS_BUG_ON(cmd->cdb[0] != READ_10);
cmd->cmd_corrupt_dif_tag = (cmd->cdb[6] & 0xE0) >> 5;
EXTRACHECKS_BUG_ON(cmd->cdb[0] != READ_10);
cmd->cmd_corrupt_dif_tag = (cmd->cdb[6] & 0xE0) >> 5;
#endif
return scst_parse_rdprotect(cmd);
}
return scst_parse_rdprotect(cmd);
}
static int get_cdb_info_lba_4_len_2_wrprotect(struct scst_cmd *cmd,
@@ -11474,13 +11471,12 @@ static int get_cdb_info_read_16(struct scst_cmd *cmd,
if (res != 0)
return res;
else {
#ifdef CONFIG_SCST_DIF_INJECT_CORRUPTED_TAGS
EXTRACHECKS_BUG_ON(cmd->cdb[0] != READ_16);
cmd->cmd_corrupt_dif_tag = (cmd->cdb[14] & 0xE0) >> 5;
EXTRACHECKS_BUG_ON(cmd->cdb[0] != READ_16);
cmd->cmd_corrupt_dif_tag = (cmd->cdb[14] & 0xE0) >> 5;
#endif
return scst_parse_rdprotect(cmd);
}
return scst_parse_rdprotect(cmd);
}
static int get_cdb_info_lba_8_len_4_wrprotect(struct scst_cmd *cmd,
+3 -2
View File
@@ -169,8 +169,9 @@ bool tid_equal(const uint8_t *tid_a, const uint8_t *tid_b)
if (tolower(tid_a[i]) != tolower(tid_b[i]))
return false;
return true;
} else
len = TID_COMMON_SIZE;
}
len = TID_COMMON_SIZE;
return memcmp(tid_a, tid_b, len) == 0;
+3 -4
View File
@@ -4937,10 +4937,9 @@ again:
if (++thr_cnt == 2)
break;
else {
spin_lock_irq(&thr->thr_cmd_list_lock);
thr_locked = true;
}
spin_lock_irq(&thr->thr_cmd_list_lock);
thr_locked = true;
}
} while (someth_done);