diff --git a/scst/src/scst_pres.c b/scst/src/scst_pres.c index 80ba46b66..983a2345d 100644 --- a/scst/src/scst_pres.c +++ b/scst/src/scst_pres.c @@ -1811,7 +1811,7 @@ void scst_pr_reserve(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) TRACE_ENTRY(); key = get_unaligned((__be64 *)&buffer[0]); - scope = (cmd->cdb[2] & 0x0f) >> 4; + scope = cmd->cdb[2] >> 4; type = cmd->cdb[2] & 0x0f; if (buffer_size != 24) { @@ -1828,7 +1828,7 @@ void scst_pr_reserve(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) goto out; } - if (((cmd->cdb[2] & 0x0f) >> 4) != SCOPE_LU) { + if (scope != SCOPE_LU) { TRACE_PR("Invalid reservation scope %d", scope); scst_set_invalid_field_in_cdb(cmd, 2, SCST_INVAL_FIELD_BIT_OFFS_VALID | 4); @@ -1897,7 +1897,7 @@ void scst_pr_release(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) TRACE_ENTRY(); key = get_unaligned((__be64 *)&buffer[0]); - scope = (cmd->cdb[2] & 0x0f) >> 4; + scope = cmd->cdb[2] >> 4; type = cmd->cdb[2] & 0x0f; if (buffer_size != 24) { @@ -2033,7 +2033,7 @@ static void scst_pr_do_preempt(struct scst_cmd *cmd, uint8_t *buffer, key = get_unaligned((__be64 *)&buffer[0]); action_key = get_unaligned((__be64 *)&buffer[8]); - scope = (cmd->cdb[2] & 0x0f) >> 4; + scope = cmd->cdb[2] >> 4; type = cmd->cdb[2] & 0x0f; if (!scst_pr_type_valid(type)) { diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 6ba53943f..0097105cf 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -2274,7 +2274,7 @@ static int scst_persistent_reserve_out_local(struct scst_cmd *cmd) /* Check scope */ if ((action != PR_REGISTER) && (action != PR_REGISTER_AND_IGNORE) && - (action != PR_CLEAR) && ((cmd->cdb[2] & 0x0f) >> 4) != SCOPE_LU) { + (action != PR_CLEAR) && (cmd->cdb[2] >> 4) != SCOPE_LU) { TRACE_PR("Scope must be SCOPE_LU for action %x", action); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb));