Commit 6154c5bc authored by Roland Dreier's avatar Roland Dreier Committed by Ben Hutchings

target: Clean up returning errors in PR handling code

commit d35212f3 upstream.

 - instead of (PTR_ERR(file) < 0) just use IS_ERR(file)
 - return -EINVAL instead of EINVAL
 - all other error returns in target_scsi3_emulate_pr_out() use
   "goto out" -- get rid of the one remaining straight "return."
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 9729de79
...@@ -2042,7 +2042,7 @@ static int __core_scsi3_write_aptpl_to_file( ...@@ -2042,7 +2042,7 @@ static int __core_scsi3_write_aptpl_to_file(
if (IS_ERR(file) || !file || !file->f_dentry) { if (IS_ERR(file) || !file || !file->f_dentry) {
pr_err("filp_open(%s) for APTPL metadata" pr_err("filp_open(%s) for APTPL metadata"
" failed\n", path); " failed\n", path);
return (PTR_ERR(file) < 0 ? PTR_ERR(file) : -ENOENT); return IS_ERR(file) ? PTR_ERR(file) : -ENOENT;
} }
iov[0].iov_base = &buf[0]; iov[0].iov_base = &buf[0];
...@@ -3853,7 +3853,7 @@ int target_scsi3_emulate_pr_out(struct se_task *task) ...@@ -3853,7 +3853,7 @@ int target_scsi3_emulate_pr_out(struct se_task *task)
" SPC-2 reservation is held, returning" " SPC-2 reservation is held, returning"
" RESERVATION_CONFLICT\n"); " RESERVATION_CONFLICT\n");
cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT;
ret = EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -3863,7 +3863,8 @@ int target_scsi3_emulate_pr_out(struct se_task *task) ...@@ -3863,7 +3863,8 @@ int target_scsi3_emulate_pr_out(struct se_task *task)
*/ */
if (!cmd->se_sess) { if (!cmd->se_sess) {
cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
return -EINVAL; ret = -EINVAL;
goto out;
} }
if (cmd->data_length < 24) { if (cmd->data_length < 24) {
......
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