diff options
author | yan <clouds.yan@gmail.com> | 2012-04-20 09:25:53 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-23 16:34:29 -0400 |
commit | 6b9606106ba58d2bd80610f97e06fea58206b47c (patch) | |
tree | cb6c557872521dced6b92ede4e486901b93b2d46 /lib | |
parent | 9169c01236ab29ce55c93aaf22ec6ecc65c46d1a (diff) |
lib/kobject.c : Remove redundant check in create_dir
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kobject.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index 21dee7c19afd..bbffa2110d43 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -47,13 +47,11 @@ static int populate_dir(struct kobject *kobj) | |||
47 | static int create_dir(struct kobject *kobj) | 47 | static int create_dir(struct kobject *kobj) |
48 | { | 48 | { |
49 | int error = 0; | 49 | int error = 0; |
50 | if (kobject_name(kobj)) { | 50 | error = sysfs_create_dir(kobj); |
51 | error = sysfs_create_dir(kobj); | 51 | if (!error) { |
52 | if (!error) { | 52 | error = populate_dir(kobj); |
53 | error = populate_dir(kobj); | 53 | if (error) |
54 | if (error) | 54 | sysfs_remove_dir(kobj); |
55 | sysfs_remove_dir(kobj); | ||
56 | } | ||
57 | } | 55 | } |
58 | return error; | 56 | return error; |
59 | } | 57 | } |