This is required so that we give up the last reference to the device.

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

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]);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to