aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hv/channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hv/channel.c')
-rw-r--r--drivers/hv/channel.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 531a593912ec..020631453394 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -435,7 +435,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
435 struct vmbus_channel_gpadl_teardown *msg; 435 struct vmbus_channel_gpadl_teardown *msg;
436 struct vmbus_channel_msginfo *info; 436 struct vmbus_channel_msginfo *info;
437 unsigned long flags; 437 unsigned long flags;
438 int ret, t; 438 int ret;
439 439
440 info = kmalloc(sizeof(*info) + 440 info = kmalloc(sizeof(*info) +
441 sizeof(struct vmbus_channel_gpadl_teardown), GFP_KERNEL); 441 sizeof(struct vmbus_channel_gpadl_teardown), GFP_KERNEL);
@@ -457,11 +457,12 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
457 ret = vmbus_post_msg(msg, 457 ret = vmbus_post_msg(msg,
458 sizeof(struct vmbus_channel_gpadl_teardown)); 458 sizeof(struct vmbus_channel_gpadl_teardown));
459 459
460 BUG_ON(ret != 0); 460 if (ret)
461 t = wait_for_completion_timeout(&info->waitevent, 5*HZ); 461 goto post_msg_err;
462 BUG_ON(t == 0); 462
463 wait_for_completion(&info->waitevent);
463 464
464 /* Received a torndown response */ 465post_msg_err:
465 spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags); 466 spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
466 list_del(&info->msglistentry); 467 list_del(&info->msglistentry);
467 spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); 468 spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);