From 40b0a842d10cf8d81a329693877903f8594dd96a Mon Sep 17 00:00:00 2001 From: Lee Duncan Date: Sat, 16 Feb 2013 13:56:18 -0800 Subject: [PATCH] Cleaned up prin_read_keys since task always passed in Cleaned up prin_read_keys() to assume task is always passed in, since that is the case. --- test-tool/iscsi-support.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c index 978564b..52b9181 100644 --- a/test-tool/iscsi-support.c +++ b/test-tool/iscsi-support.c @@ -194,47 +194,36 @@ prin_read_keys(struct iscsi_context *iscsi, int lun, struct scsi_task **tp, { const int buf_sz = 16384; struct scsi_persistent_reserve_in_read_keys *rk = NULL; - struct scsi_task *task; logging(LOG_VERBOSE, "Send PRIN/READ_KEYS"); - task = iscsi_persistent_reserve_in_sync(iscsi, lun, + *tp = iscsi_persistent_reserve_in_sync(iscsi, lun, SCSI_PERSISTENT_RESERVE_READ_KEYS, buf_sz); - if (task == NULL) { + if (*tp == NULL) { logging(LOG_NORMAL, "[FAILED] Failed to send PRIN command: %s", iscsi_get_error(iscsi)); return -1; } - if (tp != NULL) - *tp = task; - if (task->status != SCSI_STATUS_GOOD) { + if ((*tp)->status != SCSI_STATUS_GOOD) { logging(LOG_NORMAL, "[FAILED] PRIN command: failed with sense. %s", iscsi_get_error(iscsi)); - if (tp == NULL) - scsi_free_scsi_task(task); return -1; } - rk = scsi_datain_unmarshall(task); + rk = scsi_datain_unmarshall(*tp); if (rk == NULL) { logging(LOG_NORMAL, "[FAIL] failed to unmarshall PRIN/READ_KEYS data. %s", iscsi_get_error(iscsi)); - if (tp == NULL) - scsi_free_scsi_task(task); return -1; } if (rkp != NULL) *rkp = rk; - /* clean up if we are managing our own task */ - if (tp == NULL) - scsi_free_scsi_task(task); - return 0; }