aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hv/vmbus_drv.c
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2013-06-18 23:28:10 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-24 19:24:17 -0400
commit2608fb653103419ac163206ff6d51b7b6528e2d9 (patch)
tree772e6b8d52a07a4cb1fc6f5825689666e501cfe6 /drivers/hv/vmbus_drv.c
parente91e84fa4cfeb67a9a096f1adaa1a1a692474724 (diff)
drivers: hv: allocate synic structures before hv_synic_init()
We currently allocate synic structures in hv_sync_init(), but there's no way for the driver to know about the allocation failure and it may continue to use the uninitialized pointers. Solve this by introducing helpers for allocating and freeing and doing the allocation before the on_each_cpu() call in vmbus_bus_init(). Cc: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv/vmbus_drv.c')
-rw-r--r--drivers/hv/vmbus_drv.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 4004e54ef05d..a2464bf07c49 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -563,6 +563,9 @@ static int vmbus_bus_init(int irq)
563 */ 563 */
564 hv_register_vmbus_handler(irq, vmbus_isr); 564 hv_register_vmbus_handler(irq, vmbus_isr);
565 565
566 ret = hv_synic_alloc();
567 if (ret)
568 goto err_alloc;
566 /* 569 /*
567 * Initialize the per-cpu interrupt state and 570 * Initialize the per-cpu interrupt state and
568 * connect to the host. 571 * connect to the host.
@@ -570,13 +573,14 @@ static int vmbus_bus_init(int irq)
570 on_each_cpu(hv_synic_init, NULL, 1); 573 on_each_cpu(hv_synic_init, NULL, 1);
571 ret = vmbus_connect(); 574 ret = vmbus_connect();
572 if (ret) 575 if (ret)
573 goto err_irq; 576 goto err_alloc;
574 577
575 vmbus_request_offers(); 578 vmbus_request_offers();
576 579
577 return 0; 580 return 0;
578 581
579err_irq: 582err_alloc:
583 hv_synic_free();
580 free_irq(irq, hv_acpi_dev); 584 free_irq(irq, hv_acpi_dev);
581 585
582err_unregister: 586err_unregister: