aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Dreier <roland@purestorage.com>2012-07-16 18:17:10 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2012-07-16 19:42:40 -0400
commitd35212f3ca3bf4fb49d15e37f530c9931e2d2183 (patch)
tree46860cf1a398eb26ae3ec24802392aa43c79dbbb
parent3cc5d2a6b9a2fd1bf024aa5e52dd22961eecaf13 (diff)
target: Clean up returning errors in PR handling code
- 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: Roland Dreier <roland@purestorage.com> Cc: <stable@vger.kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/target_core_pr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 85564998500a..a1bcd927a9e6 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -2031,7 +2031,7 @@ static int __core_scsi3_write_aptpl_to_file(
2031 if (IS_ERR(file) || !file || !file->f_dentry) { 2031 if (IS_ERR(file) || !file || !file->f_dentry) {
2032 pr_err("filp_open(%s) for APTPL metadata" 2032 pr_err("filp_open(%s) for APTPL metadata"
2033 " failed\n", path); 2033 " failed\n", path);
2034 return (PTR_ERR(file) < 0 ? PTR_ERR(file) : -ENOENT); 2034 return IS_ERR(file) ? PTR_ERR(file) : -ENOENT;
2035 } 2035 }
2036 2036
2037 iov[0].iov_base = &buf[0]; 2037 iov[0].iov_base = &buf[0];
@@ -3818,7 +3818,7 @@ int target_scsi3_emulate_pr_out(struct se_cmd *cmd)
3818 " SPC-2 reservation is held, returning" 3818 " SPC-2 reservation is held, returning"
3819 " RESERVATION_CONFLICT\n"); 3819 " RESERVATION_CONFLICT\n");
3820 cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; 3820 cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT;
3821 ret = EINVAL; 3821 ret = -EINVAL;
3822 goto out; 3822 goto out;
3823 } 3823 }
3824 3824
@@ -3828,7 +3828,8 @@ int target_scsi3_emulate_pr_out(struct se_cmd *cmd)
3828 */ 3828 */
3829 if (!cmd->se_sess) { 3829 if (!cmd->se_sess) {
3830 cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 3830 cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
3831 return -EINVAL; 3831 ret = -EINVAL;
3832 goto out;
3832 } 3833 }
3833 3834
3834 if (cmd->data_length < 24) { 3835 if (cmd->data_length < 24) {