]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
IB: Fix return value in ib_device_register_sysfs()
authorLi Zefan <lizf@cn.fujitsu.com>
Fri, 15 Feb 2008 02:24:49 +0000 (10:24 +0800)
committerRoland Dreier <rolandd@cisco.com>
Fri, 15 Feb 2008 23:05:05 +0000 (15:05 -0800)
If kobject_create_and_add() fails and returns NULL, the current code
in ib_device_register_sysfs() does not set ret and hence returns 0.
Set ret to -ENOMEM for this failure, so that the caller knows that
ib_device_register_sysfs() actually failed.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/core/sysfs.c

index c864ef70fdf9633db07e00723aeceb47bd0cba4a..5a4b2e65534b4b4fcd1fc878a0477dc5096126b1 100644 (file)
@@ -686,8 +686,10 @@ int ib_device_register_sysfs(struct ib_device *device)
 
        device->ports_parent = kobject_create_and_add("ports",
                                        kobject_get(&class_dev->kobj));
-       if (!device->ports_parent)
+       if (!device->ports_parent) {
+               ret = -ENOMEM;
                goto err_put;
+       }
 
        if (device->node_type == RDMA_NODE_IB_SWITCH) {
                ret = add_port(device, 0);