All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][Trivial] lib/kobject.c: Remove redundant check in populate_dir
@ 2012-04-21 10:18 yan
  2012-04-23 20:43 ` greg
  0 siblings, 1 reply; 2+ messages in thread
From: yan @ 2012-04-21 10:18 UTC (permalink / raw)
  To: greg; +Cc: kernel, message

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@gmail.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




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-23 20:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-21 10:18 [PATCH][Trivial] lib/kobject.c: Remove redundant check in populate_dir yan
2012-04-23 20:43 ` greg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.