lib/kobject.c : Remove redundant check in create_dir
authoryan <clouds.yan@gmail.com>
Fri, 20 Apr 2012 13:25:53 +0000 (21:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Apr 2012 20:34:29 +0000 (13:34 -0700)
create_dir is a static function used only in kobject_add_internal.
There's no need to do check here, for kobject_add_internal will
reject kobject with invalid name.

Signed-off-by: Yan Hong <clouds.yan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lib/kobject.c

index 21dee7c19afd8e9c493bec8585869f098545f4ff..bbffa2110d433f93e88eb6538cfd59916edfd81f 100644 (file)
@@ -47,13 +47,11 @@ static int populate_dir(struct kobject *kobj)
 static int create_dir(struct kobject *kobj)
 {
        int error = 0;
-       if (kobject_name(kobj)) {
-               error = sysfs_create_dir(kobj);
-               if (!error) {
-                       error = populate_dir(kobj);
-                       if (error)
-                               sysfs_remove_dir(kobj);
-               }
+       error = sysfs_create_dir(kobj);
+       if (!error) {
+               error = populate_dir(kobj);
+               if (error)
+                       sysfs_remove_dir(kobj);
        }
        return error;
 }