From 1204ff34e0b83a286e390d0fa61962a47d7a130a Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Tue, 4 Jun 2019 16:49:52 +0900 Subject: [PATCH] iscsi: Update _pdu only when completing read in spdk_iscsi_read_pdu The only caller iscsi_conn_handle_incoming_pdus accesses the returned pdu only when the return code is 1. So we can remove update of _pdu for other cases in spdk_iscsi_read_pdu. Signed-off-by: Shuhei Matsumoto Change-Id: I54b9f050c3b45c87f4797a90d7606638d6c821ad Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456771 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris --- lib/iscsi/iscsi.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index f42d21fba..c551d2343 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -426,7 +426,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu) } pdu->bhs_valid_bytes += rc; if (pdu->bhs_valid_bytes < ISCSI_BHS_LEN) { - *_pdu = NULL; return 0; } } @@ -446,7 +445,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu) pdu->ahs_valid_bytes += rc; if (pdu->ahs_valid_bytes < ahs_len) { - *_pdu = NULL; return 0; } } @@ -463,7 +461,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu) pdu->hdigest_valid_bytes += rc; if (pdu->hdigest_valid_bytes < ISCSI_DIGEST_LEN) { - *_pdu = NULL; return 0; } } @@ -484,7 +481,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu) } pdu->mobj = spdk_mempool_get(pool); if (pdu->mobj == NULL) { - *_pdu = NULL; return 0; } pdu->data_buf = pdu->mobj->buf; @@ -497,7 +493,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu) pdu->data_valid_bytes += rc; if (pdu->data_valid_bytes < data_len) { - *_pdu = NULL; return 0; } } @@ -514,7 +509,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu) pdu->ddigest_valid_bytes += rc; if (pdu->ddigest_valid_bytes < ISCSI_DIGEST_LEN) { - *_pdu = NULL; return 0; } } @@ -570,7 +564,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu) return 1; error: - *_pdu = NULL; spdk_put_pdu(pdu); conn->pdu_in_progress = NULL; return SPDK_ISCSI_CONNECTION_FATAL;