Commit 5c22e229 authored by Joern Engel's avatar Joern Engel Committed by Nicholas Bellinger

iscsi-target: simplify return statement

The return statement cannot be reached without either recovery or dump
being set to 1.  Therefore the condition always evaluates to true and
recovery and dump are useless variables.

Found by Coverity.
Signed-off-by: default avatarJoern Engel <joern@logfs.org>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent cb354842
...@@ -345,7 +345,6 @@ static int iscsit_dataout_check_datasn( ...@@ -345,7 +345,6 @@ static int iscsit_dataout_check_datasn(
struct iscsi_cmd *cmd, struct iscsi_cmd *cmd,
unsigned char *buf) unsigned char *buf)
{ {
int dump = 0, recovery = 0;
u32 data_sn = 0; u32 data_sn = 0;
struct iscsi_conn *conn = cmd->conn; struct iscsi_conn *conn = cmd->conn;
struct iscsi_data *hdr = (struct iscsi_data *) buf; struct iscsi_data *hdr = (struct iscsi_data *) buf;
...@@ -370,13 +369,11 @@ static int iscsit_dataout_check_datasn( ...@@ -370,13 +369,11 @@ static int iscsit_dataout_check_datasn(
pr_err("Command ITT: 0x%08x, received DataSN: 0x%08x" pr_err("Command ITT: 0x%08x, received DataSN: 0x%08x"
" higher than expected 0x%08x.\n", cmd->init_task_tag, " higher than expected 0x%08x.\n", cmd->init_task_tag,
be32_to_cpu(hdr->datasn), data_sn); be32_to_cpu(hdr->datasn), data_sn);
recovery = 1;
goto recover; goto recover;
} else if (be32_to_cpu(hdr->datasn) < data_sn) { } else if (be32_to_cpu(hdr->datasn) < data_sn) {
pr_err("Command ITT: 0x%08x, received DataSN: 0x%08x" pr_err("Command ITT: 0x%08x, received DataSN: 0x%08x"
" lower than expected 0x%08x, discarding payload.\n", " lower than expected 0x%08x, discarding payload.\n",
cmd->init_task_tag, be32_to_cpu(hdr->datasn), data_sn); cmd->init_task_tag, be32_to_cpu(hdr->datasn), data_sn);
dump = 1;
goto dump; goto dump;
} }
...@@ -392,8 +389,7 @@ static int iscsit_dataout_check_datasn( ...@@ -392,8 +389,7 @@ static int iscsit_dataout_check_datasn(
if (iscsit_dump_data_payload(conn, payload_length, 1) < 0) if (iscsit_dump_data_payload(conn, payload_length, 1) < 0)
return DATAOUT_CANNOT_RECOVER; return DATAOUT_CANNOT_RECOVER;
return (recovery || dump) ? DATAOUT_WITHIN_COMMAND_RECOVERY : return DATAOUT_WITHIN_COMMAND_RECOVERY;
DATAOUT_NORMAL;
} }
static int iscsit_dataout_pre_datapduinorder_yes( static int iscsit_dataout_pre_datapduinorder_yes(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment