Skip to contentSkip to conversation

Staging: hv: vmbus: Don't wait indefinitely for IRQ resouces

PATCH New K. Y. Srinivasan 1 participant 1 message Jul 15, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: hv: vmbus: Don't wait indefinitely for IRQ resouces

If an attempt is made to load the vmbus driver on a non-Hyper-V platform, the load operation will hang since we currently wait indefinitely to retrieve the IRQ information. This is done in the context of an acpi callback context (which will obviously not happen when this driver is loaded on a non-Hyper-V platform). This patch fixes the problem.

---
 drivers/staging/hv/vmbus_drv.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
drivers/staging/hv/vmbus_drv.c +14 -5
index 433be51..b382829 100644
@@ -702,7 +702,7 @@ static struct acpi_driver vmbus_acpi_driver = {
 
 static int __init hv_acpi_init(void)
 {
-	int ret;
+	int ret, t;
 
 	init_completion(&probe_event);
 
@@ -715,16 +715,25 @@ static int __init hv_acpi_init(void)
 	if (ret)
 		return ret;
 
-	wait_for_completion(&probe_event);
+	t = wait_for_completion_timeout(&probe_event, 5*HZ);
+	if (t == 0) {
+		ret = -ETIMEDOUT;
+		goto cleanup;
+	}
 
 	if (irq <= 0) {
-		acpi_bus_unregister_driver(&vmbus_acpi_driver);
-		return -ENODEV;
+		ret = -ENODEV;
+		goto cleanup;
 	}
 
 	ret = vmbus_bus_init(irq);
 	if (ret)
-		acpi_bus_unregister_driver(&vmbus_acpi_driver);
+		goto cleanup;
+
+	return 0;
+
+cleanup:
+	acpi_bus_unregister_driver(&vmbus_acpi_driver);
 	return ret;
 }
 
Signature · 1 line
1.7.4.1