From ff38547d8046ae50a090f79a45356abca9e8b3dd Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Tue, 27 Sep 2016 14:25:42 +0800 Subject: [PATCH] iSCSI: change return value of spdk_iscsi_conn_free_tasks We need to return -1, when there is still tasks. From the usage, return 1 is wrong. Change-Id: Ibf1b53e0be92818c73590c0b4211d34332073c74 Signed-off-by: Ziye Yang --- lib/iscsi/conn.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index 0f236e4c3..ff02d911a 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -420,16 +420,18 @@ static int spdk_iscsi_conn_free_tasks(struct spdk_iscsi_conn *conn) while (!TAILQ_EMPTY(&conn->write_pdu_list)) { pdu = TAILQ_FIRST(&conn->write_pdu_list); TAILQ_REMOVE(&conn->write_pdu_list, pdu, tailq); - if (pdu->task) + if (pdu->task) { spdk_iscsi_task_put(pdu->task); + } spdk_put_pdu(pdu); } while (!TAILQ_EMPTY(&conn->snack_pdu_list)) { pdu = TAILQ_FIRST(&conn->snack_pdu_list); TAILQ_REMOVE(&conn->snack_pdu_list, pdu, tailq); - if (pdu->task) + if (pdu->task) { spdk_iscsi_task_put(pdu->task); + } spdk_put_pdu(pdu); } @@ -442,7 +444,7 @@ static int spdk_iscsi_conn_free_tasks(struct spdk_iscsi_conn *conn) } if (conn->pending_task_cnt) - return 1; + return -1; return 0;