Kobject: convert kernel/user.c to use kobject_init/add_ng()
authorGreg Kroah-Hartman <gregkh@suse.de>
Tue, 18 Dec 2007 06:05:35 +0000 (23:05 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Jan 2008 04:40:31 +0000 (20:40 -0800)
This converts the code to use the new kobject functions, cleaning up the
logic in doing so.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kernel/user.c

index 7f17e6e8fd65628f9e28a0c461c0481a5ae95ff8..ab4fd706993b1e22dccae4d3fafcf0cf0f48fbb3 100644 (file)
@@ -181,13 +181,12 @@ static int uids_user_create(struct user_struct *up)
        int error;
 
        memset(kobj, 0, sizeof(struct kobject));
-       kobj->ktype = &uids_ktype;
        kobj->kset = uids_kset;
-       kobject_init(kobj);
-       kobject_set_name(&up->kobj, "%d", up->uid);
-       error = kobject_add(kobj);
-       if (error)
+       error = kobject_init_and_add(kobj, &uids_ktype, NULL, "%d", up->uid);
+       if (error) {
+               kobject_put(kobj);
                goto done;
+       }
 
        kobject_uevent(kobj, KOBJ_ADD);
 done: