diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 6ed5d2b90..6f123fa3f 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -2100,7 +2100,8 @@ static void scst_req_done(struct scsi_cmnd *scsi_cmd) TRACE_ENTRY(); - if (scsi_cmd && (req = scsi_cmd->sc_request)) { + if (scsi_cmd) { + req = scsi_cmd->sc_request; if (req) { if (req->sr_bufflen) kfree(req->sr_buffer); diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index c512d3fc8..fb77f550c 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -1255,8 +1255,11 @@ static inline struct scst_cmd *scst_get_cmd(struct scsi_cmnd *scsi_cmd, { struct scst_cmd *cmd = NULL; - if (scsi_cmd && (*req = scsi_cmd->sc_request)) - cmd = (struct scst_cmd *)(*req)->upper_private_data; + if (scsi_cmd) { + *req = scsi_cmd->sc_request; + if (*req) + cmd = (struct scst_cmd *)(*req)->upper_private_data; + } if (cmd == NULL) { PRINT_ERROR("%s", "Request with NULL cmd");