Commit 71a6655d authored by K. Y. Srinivasan's avatar K. Y. Srinivasan Committed by Greg Kroah-Hartman

Staging: hv: Properly handle errors in hv_pci_probe()

Much of the vmbus driver initialization is done within the hv_pci_probe()
function. Properly handle errors in hv_pci_probe so that we can
appropriately deal with loading of the vmbus driver.
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarAbhishek Kane <v-abkane@microsoft.com>
Signed-off-by: default avatarHank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b14a7b30
No related merge requests found
...@@ -54,6 +54,8 @@ EXPORT_SYMBOL(vmbus_loglevel); ...@@ -54,6 +54,8 @@ EXPORT_SYMBOL(vmbus_loglevel);
/* (ALL_MODULES << 16 | DEBUG_LVL_ENTEREXIT); */ /* (ALL_MODULES << 16 | DEBUG_LVL_ENTEREXIT); */
/* (((VMBUS | VMBUS_DRV)<<16) | DEBUG_LVL_ENTEREXIT); */ /* (((VMBUS | VMBUS_DRV)<<16) | DEBUG_LVL_ENTEREXIT); */
static int pci_probe_error;
static struct completion probe_event;
static void get_channel_info(struct hv_device *device, static void get_channel_info(struct hv_device *device,
struct hv_device_info *info) struct hv_device_info *info)
...@@ -722,19 +724,19 @@ void vmbus_child_device_unregister(struct hv_device *device_obj) ...@@ -722,19 +724,19 @@ void vmbus_child_device_unregister(struct hv_device *device_obj)
static int __devinit hv_pci_probe(struct pci_dev *pdev, static int __devinit hv_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
int err;
hv_pci_dev = pdev; hv_pci_dev = pdev;
err = pci_enable_device(pdev); pci_probe_error = pci_enable_device(pdev);
if (err) if (pci_probe_error)
return err; goto probe_cleanup;
err = vmbus_bus_init(pdev); pci_probe_error = vmbus_bus_init(pdev);
if (err) if (pci_probe_error)
pci_disable_device(pdev); pci_disable_device(pdev);
return err; probe_cleanup:
complete(&probe_event);
return pci_probe_error;
} }
/* /*
...@@ -757,7 +759,21 @@ static struct pci_driver hv_bus_driver = { ...@@ -757,7 +759,21 @@ static struct pci_driver hv_bus_driver = {
static int __init hv_pci_init(void) static int __init hv_pci_init(void)
{ {
return pci_register_driver(&hv_bus_driver); int ret;
init_completion(&probe_event);
ret = pci_register_driver(&hv_bus_driver);
if (ret)
return ret;
/*
* All the vmbus initialization occurs within the
* hv_pci_probe() function. Wait for hv_pci_probe()
* to complete.
*/
wait_for_completion(&probe_event);
if (pci_probe_error)
pci_unregister_driver(&hv_bus_driver);
return pci_probe_error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment