lkml.org 
[lkml]   [2012]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] lib/kobject.c : Remove redundant check in create_dir
From
Date
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>
---
lib/kobject.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/lib/kobject.c b/lib/kobject.c
index aeefa8b..38fcc60 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -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;
}
--
1.7.5.1




\
 
 \ /
  Last update: 2012-04-20 15:29    [W:0.031 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site