Staging: hv: check return value of device_register()
authorBill Pemberton <wfp5p@virginia.edu>
Mon, 27 Jul 2009 20:47:36 +0000 (16:47 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 15 Sep 2009 19:01:51 +0000 (12:01 -0700)
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/hv/blkvsc_drv.c
drivers/staging/hv/include/vmbus.h
drivers/staging/hv/netvsc_drv.c
drivers/staging/hv/storvsc_drv.c
drivers/staging/hv/vmbus_drv.c

index 5322e570bd8caa94589ed4a1fe5b8eae4cc3d3ab..f1efc3e65c1fa2ff36e5855c3d3127feaa44648a 100644 (file)
@@ -192,7 +192,7 @@ int blkvsc_drv_init(PFN_DRIVERINITIALIZE pfn_drv_init)
        drv_ctx->shutdown = blkvsc_shutdown;
 
        /* The driver belongs to vmbus */
-       vmbus_child_driver_register(drv_ctx);
+       ret = vmbus_child_driver_register(drv_ctx);
 
        DPRINT_EXIT(BLKVSC_DRV);
 
index 463f77ef3cd99caf3e1c5976e4748215c354ade0..c1a8c553edaa1151b12886e632ce2056a43cf836 100644 (file)
@@ -82,8 +82,7 @@ static inline struct driver_context *driver_to_driver_context(struct device_driv
 
 /* Vmbus interface */
 
-void
-vmbus_child_driver_register(
+int vmbus_child_driver_register(
        struct driver_context* driver_ctx
        );
 
index 8cf552a33e53a079a816a2100e792fbe940da1d0..82f77008b9b5f7086f588864087457c013ac0587 100644 (file)
@@ -114,7 +114,7 @@ int netvsc_drv_init(PFN_DRIVERINITIALIZE pfn_drv_init)
        drv_ctx->remove = netvsc_remove;
 
        /* The driver belongs to vmbus */
-       vmbus_child_driver_register(drv_ctx);
+       ret = vmbus_child_driver_register(drv_ctx);
 
        DPRINT_EXIT(NETVSC_DRV);
 
index 3c677f015c4725f1ebd5b741e53caaebb6671dbc..cbea8a2f0541447ed31b791888f3941a0481704e 100644 (file)
@@ -162,7 +162,7 @@ int storvsc_drv_init(PFN_DRIVERINITIALIZE pfn_drv_init)
        drv_ctx->remove = storvsc_remove;
 
        /* The driver belongs to vmbus */
-       vmbus_child_driver_register(drv_ctx);
+       ret = vmbus_child_driver_register(drv_ctx);
 
        DPRINT_EXIT(STORVSC_DRV);
 
index cede0ace9ad5bcb5763a4944b9b1b0afc33fc40a..fd6f18e148d1a521ce9946a09bba8dbf69683e02 100644 (file)
@@ -435,7 +435,18 @@ int vmbus_bus_init(PFN_DRIVERINITIALIZE pfn_drv_init)
        dev_ctx->device.release = vmbus_bus_release;
 
        /* Setup the bus as root device */
-       device_register(&dev_ctx->device);
+       ret = device_register(&dev_ctx->device);
+       if (ret)
+       {
+               DPRINT_ERR(VMBUS_DRV, "ERROR - Unable to register vmbus root device");
+
+               free_irq(vmbus_irq, NULL);
+               bus_unregister(&vmbus_drv_ctx->bus);
+
+               ret = -1;
+               goto cleanup;
+       }
+
 
        vmbus_drv_obj->GetChannelOffers();
 
@@ -491,9 +502,10 @@ Name:      vmbus_child_driver_register()
 Desc:  Register a vmbus's child driver
 
 --*/
-void vmbus_child_driver_register(struct driver_context* driver_ctx)
+int vmbus_child_driver_register(struct driver_context* driver_ctx)
 {
        VMBUS_DRIVER_OBJECT *vmbus_drv_obj=&g_vmbus_drv.drv_obj;
+       int ret;
 
        DPRINT_ENTER(VMBUS_DRV);
 
@@ -502,11 +514,13 @@ void vmbus_child_driver_register(struct driver_context* driver_ctx)
        /* The child driver on this vmbus */
        driver_ctx->driver.bus = &g_vmbus_drv.bus;
 
-       driver_register(&driver_ctx->driver);
+       ret = driver_register(&driver_ctx->driver);
 
        vmbus_drv_obj->GetChannelOffers();
 
        DPRINT_EXIT(VMBUS_DRV);
+
+       return ret;
 }
 
 EXPORT_SYMBOL(vmbus_child_driver_register);