Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c7482b81c8b524193d736488c149adbe27a7eb7f
Commit:     c7482b81c8b524193d736488c149adbe27a7eb7f
Parent:     101142c37be8e5af9b847860219217e6b958c739
Author:     Li Zefan <[EMAIL PROTECTED]>
AuthorDate: Fri Feb 15 10:24:49 2008 +0800
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Fri Feb 15 15:05:05 2008 -0800

    IB: Fix return value in ib_device_register_sysfs()
    
    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 <[EMAIL PROTECTED]>
    Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/core/sysfs.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index c864ef7..5a4b2e6 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -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);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to