diff options
author | Bill Pemberton <wfp5p@virginia.edu> | 2009-07-27 16:47:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-15 12:01:51 -0700 |
commit | 5d48a1c20268871395299672dce5c1989c9c94e4 (patch) | |
tree | 04db3e5b2a5dadcf3e6bf083de81d00f71ed7f52 /drivers/staging/hv/vmbus_drv.c | |
parent | c19fbca307c19bd0d49e86b9417613c90eb9de95 (diff) | |
download | op-kernel-dev-5d48a1c20268871395299672dce5c1989c9c94e4.zip op-kernel-dev-5d48a1c20268871395299672dce5c1989c9c94e4.tar.gz |
Staging: hv: check return value of device_register()
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/hv/vmbus_drv.c')
-rw-r--r-- | drivers/staging/hv/vmbus_drv.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c index cede0ac..fd6f18e 100644 --- a/drivers/staging/hv/vmbus_drv.c +++ b/drivers/staging/hv/vmbus_drv.c @@ -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); |