lib/kobject.c: Remove redundant check in populate_dir
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- lib/kobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
lib/kobject.c +1 -1
@@ -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)
Signature · 1 line
1.7.5.1
greg
maintainerQuoted 14 lines · yan
create_dirwill callsysfs_create_dirand thenpopulate_dir. If ktype of kobject is null,sysfs_craete_dirwill lead to oops first. There is no need to check ktype inpopulate_dir.Signed-off-by Yan Hong <[email protected]>--- lib/kobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)lib/kobject.c +0
-0
lib/kobject.c static int populate_dir(struct kobject *kobj) · line 37
Quoted 5 lines
lib/kobject.c +1
-1@@ -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) {
I don't know, I think I'd like to keep this check for now, as it was put there for a reason. Yes, it's a reason lost to the sands of time, but is it costing us anything if it is still there?
greg k-h