diff mbox

[azure,03/14] UBUNTU: SAUCE: vmbus: remove "goto error_clean_msglist" in vmbus_open()

Message ID 1497979654-27251-4-git-send-email-marcelo.cerri@canonical.com
State New
Headers show

Commit Message

Marcelo Henrique Cerri June 20, 2017, 5:27 p.m. UTC
From: Dexuan Cui <decui@microsoft.com>

BugLink: http://bugs.launchpad.net/bugs/1698425

This is just a cleanup patch to simplify the code a little.
No semantic change.

Signed-off-by: Dexuan Cui <decui@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
---
 drivers/hv/channel.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
diff mbox

Patch

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 334b8d83c0df..c9414393c9bc 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -180,17 +180,18 @@  int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
 	ret = vmbus_post_msg(open_msg,
 			     sizeof(struct vmbus_channel_open_channel), true);
 
-	if (ret != 0) {
-		err = ret;
-		goto error_clean_msglist;
-	}
-
-	wait_for_completion(&open_info->waitevent);
+	if (ret == 0)
+		wait_for_completion(&open_info->waitevent);
 
 	spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
 	list_del(&open_info->msglistentry);
 	spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
 
+	if (ret != 0) {
+		err = ret;
+		goto error_free_gpadl;
+	}
+
 	if (newchannel->rescind) {
 		err = -ENODEV;
 		goto error_free_gpadl;
@@ -205,11 +206,6 @@  int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
 	kfree(open_info);
 	return 0;
 
-error_clean_msglist:
-	spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
-	list_del(&open_info->msglistentry);
-	spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
-
 error_free_gpadl:
 	vmbus_teardown_gpadl(newchannel, newchannel->ringbuffer_gpadlhandle);
 	kfree(open_info);