[PATCH] vmbus: use put_device() if device_register fail
From: Arvind Yadav
Date: Sun Mar 18 2018 - 02:48:26 EST
if device_register() returned an error. Always use put_device()
to give up the reference initialized.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
---
drivers/hv/vmbus_drv.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index bc65c4d..25da2f3 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1358,6 +1358,7 @@ int vmbus_device_register(struct hv_device *child_device_obj)
ret = device_register(&child_device_obj->device);
if (ret) {
pr_err("Unable to register child device\n");
+ put_device(&child_device_obj->device);
return ret;
}
--
2.7.4