kobject: must_check fixes
authorRandy Dunlap <rdunlap@xenotime.net>
Wed, 12 Jul 2006 03:49:41 +0000 (20:49 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 26 Sep 2006 04:08:39 +0000 (21:08 -0700)
Check all __must_check warnings in lib/kobject.c

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
lib/kobject.c

index 8e7c7199348749e63bb4cf17868e2123aa2c44fc..1699eb9161f34594a38cc28fbea1f0ab2db56893 100644 (file)
@@ -407,6 +407,7 @@ static struct kobj_type dir_ktype = {
 struct kobject *kobject_add_dir(struct kobject *parent, const char *name)
 {
        struct kobject *k;
+       int ret;
 
        if (!parent)
                return NULL;
@@ -418,7 +419,13 @@ struct kobject *kobject_add_dir(struct kobject *parent, const char *name)
        k->parent = parent;
        k->ktype = &dir_ktype;
        kobject_set_name(k, name);
-       kobject_register(k);
+       ret = kobject_register(k);
+       if (ret < 0) {
+               printk(KERN_WARNING "kobject_add_dir: "
+                       "kobject_register error: %d\n", ret);
+               kobject_del(k);
+               return NULL;
+       }
 
        return k;
 }