From d22d136bfc4dbf09d932f9cc3ba73011d0026d65 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Thu, 6 Dec 2018 08:22:03 +0900 Subject: [PATCH] iscsi: Move error path to the end of the function Moving error path to the end of the function will be easier to read. Change-Id: I35bfd9b12d83ccb6fffe159b68dd08c87f6de0fb Signed-off-by: Shuhei Matsumoto Reviewed-on: https://review.gerrithub.io/436229 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Changpeng Liu Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/iscsi/conn.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index 6e762e424..d4e593637 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -336,10 +336,7 @@ spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal, rc = spdk_iscsi_conn_params_init(&conn->params); if (rc < 0) { SPDK_ERRLOG("iscsi_conn_params_init() failed\n"); -error_return: - spdk_iscsi_param_free(conn->params); - free_conn(conn); - return -1; + goto error_return; } conn->logout_timer = NULL; conn->shutdown_timer = NULL; @@ -351,6 +348,11 @@ error_return: spdk_iscsi_poll_group_add_conn(conn); return 0; + +error_return: + spdk_iscsi_param_free(conn->params); + free_conn(conn); + return -1; } void