[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1335003508.2188.44.camel@yan>
Date: Sat, 21 Apr 2012 18:18:25 +0800
From: yan <clouds.yan@...il.com>
To: greg <gregkh@...uxfoundation.org>
Cc: kernel <linux-kernel@...r.kernel.org>,
message <message.get@...il.com>
Subject: [PATCH][Trivial] lib/kobject.c: Remove redundant check in
populate_dir
create_dir will call sysfs_create_dir and then populate_dir.
If ktype of kobject is null, sysfs_craete_dir will lead to
oops first. There is no need to check ktype in populate_dir.
Signed-off-by: Yan Hong <clouds.yan@...il.com>
---
lib/kobject.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/kobject.c b/lib/kobject.c
index bc05922..85d5e9b 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -34,7 +34,7 @@ static int populate_dir(struct kobject *kobj)
int error = 0;
int i;
- if (t && t->default_attrs) {
+ if (t->default_attrs) {
for (i = 0; (attr = t->default_attrs[i]) != NULL; i++) {
error = sysfs_create_file(kobj, attr);
if (error)
--
1.7.5.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists