Staging: hv: vmbus: Fix a bug in error handling in vmbus_bus_init()
authorK. Y. Srinivasan <kys@microsoft.com>
Wed, 31 Aug 2011 21:35:55 +0000 (14:35 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 6 Sep 2011 18:53:51 +0000 (11:53 -0700)
Fix a bug in error handling in vmbus_bus_init().

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/hv/vmbus_drv.c

index 757943b5d40698df2108d32d0be8301f73ed7a6f..b5e06d68f0582dbedd019bcc1d3af6af063b8e43 100644 (file)
@@ -492,7 +492,7 @@ static int vmbus_bus_init(int irq)
 
        ret = bus_register(&hv_bus);
        if (ret)
-               return ret;
+               goto err_cleanup;
 
        ret = request_irq(irq, vmbus_isr, IRQF_SAMPLE_RANDOM,
                        driver_name, hv_acpi_dev);
@@ -500,10 +500,7 @@ static int vmbus_bus_init(int irq)
        if (ret != 0) {
                pr_err("Unable to request IRQ %d\n",
                           irq);
-
-               bus_unregister(&hv_bus);
-
-               return ret;
+               goto err_unregister;
        }
 
        vector = IRQ0_VECTOR + irq;
@@ -514,16 +511,23 @@ static int vmbus_bus_init(int irq)
         */
        on_each_cpu(hv_synic_init, (void *)&vector, 1);
        ret = vmbus_connect();
-       if (ret) {
-               free_irq(irq, hv_acpi_dev);
-               bus_unregister(&hv_bus);
-               return ret;
-       }
-
+       if (ret)
+               goto err_irq;
 
        vmbus_request_offers();
 
        return 0;
+
+err_irq:
+       free_irq(irq, hv_acpi_dev);
+
+err_unregister:
+       bus_unregister(&hv_bus);
+
+err_cleanup:
+       hv_cleanup();
+
+       return ret;
 }
 
 /**