diff mbox

[34/38] infiniband: core: add missing put_device call

Message ID 1387465612-3673-35-git-send-email-levex@linux.com (mailing list archive)
State Rejected
Headers show

Commit Message

Levente Kurusa Dec. 19, 2013, 3:06 p.m. UTC
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa <levex@linux.com>
---
 drivers/infiniband/core/sysfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index faad2ca..bf279ce 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -824,8 +824,10 @@  int ib_device_register_sysfs(struct ib_device *device,
 	INIT_LIST_HEAD(&device->port_list);
 
 	ret = device_register(class_dev);
-	if (ret)
+	if (ret) {
+		put_device(class_dev);
 		goto err;
+	}
 
 	for (i = 0; i < ARRAY_SIZE(ib_class_attributes); ++i) {
 		ret = device_create_file(class_dev, ib_class_attributes[i]);