Skip to content

Commit

Permalink
lib/kobject.c : Remove redundant check in create_dir
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
yan authored and Greg Kroah-Hartman committed Apr 23, 2012
1 parent 9169c01 commit 6b96061
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/kobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 6b96061

Please sign in to comment.