diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 6ddf71540..5d359acd4 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -7143,8 +7143,9 @@ static int get_cdb_info_min(struct scst_cmd *cmd, break; case MI_REPORT_SUPPORTED_OPERATION_CODES: cmd->op_name = "REPORT SUPPORTED OPERATION CODES"; - cmd->op_flags |= SCST_WRITE_EXCL_ALLOWED | - SCST_LOCAL_CMD | SCST_FULLY_LOCAL_CMD; + cmd->op_flags |= SCST_WRITE_EXCL_ALLOWED; + if (cmd->devt->get_supported_opcodes != NULL) + cmd->op_flags |= SCST_LOCAL_CMD | SCST_FULLY_LOCAL_CMD; break; case MI_REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS: cmd->op_name = "REPORT SUPPORTED TASK MANAGEMENT FUNCTIONS"; diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 3011e43eb..41de5b8fb 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -2134,21 +2134,15 @@ static int scst_report_supported_opcodes(struct scst_cmd *cmd) int req_sa = get_unaligned_be16(&cmd->cdb[4]); const struct scst_opcode_descriptor *op = NULL; const struct scst_opcode_descriptor **supp_opcodes = NULL; - int supp_opcodes_cnt; + int supp_opcodes_cnt, rc; TRACE_ENTRY(); - if (cmd->devt->get_supported_opcodes == NULL) { - TRACE(TRACE_MINOR, "REPORT SUPPORTED OPCODES not supported by " - "dev handler %s", cmd->devt->name); - scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); + /* get_cdb_info_min() ensures that get_supported_opcodes is not NULL here */ + + rc = cmd->devt->get_supported_opcodes(cmd, &supp_opcodes, &supp_opcodes_cnt); + if (rc != 0) goto out_compl; - } else { - int rc = cmd->devt->get_supported_opcodes(cmd, &supp_opcodes, - &supp_opcodes_cnt); - if (rc != 0) - goto out_compl; - } TRACE_DBG("cmd %p, options %d, req_opcode %x, req_sa %x, rctd %d", cmd, options, req_opcode, req_sa, rctd);