From 05d080488eb23640e13ec186b002f97c2807da7a Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Mon, 2 Aug 2010 17:58:03 +0000 Subject: [PATCH] Small improvements git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1907 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst_local/scst_local.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 66013c5c7..1c913fc39 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -434,16 +434,18 @@ static int scst_local_send_resp(struct scsi_cmnd *cmnd, TRACE_ENTRY(); - if (cmnd && scst_cmnd) { + if (scst_cmnd) { + /* The buffer isn't ours, so let's be safe and restore it */ + scst_check_restore_sg_buff(scst_cmnd); + /* Simulate autosense by this driver */ - if (SAM_STAT_CHECK_CONDITION == (scsi_result & 0xFF)) + if (unlikely(SCST_SENSE_VALID(scst_cmnd->sense))) copy_sense(cmnd, scst_cmnd); } - if (cmnd) - cmnd->result = scsi_result; - if (done) - done(cmnd); + cmnd->result = scsi_result; + + done(cmnd); TRACE_EXIT_RES(ret); return ret;