diff options
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/module.c b/kernel/module.c index 0ae811785c59..89cd4c7361d8 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1217,18 +1217,16 @@ int mod_sysfs_init(struct module *mod) | |||
1217 | err = -EINVAL; | 1217 | err = -EINVAL; |
1218 | goto out; | 1218 | goto out; |
1219 | } | 1219 | } |
1220 | memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj)); | ||
1221 | err = kobject_set_name(&mod->mkobj.kobj, "%s", mod->name); | ||
1222 | if (err) | ||
1223 | goto out; | ||
1224 | mod->mkobj.kobj.kset = module_kset; | ||
1225 | mod->mkobj.kobj.ktype = &module_ktype; | ||
1226 | mod->mkobj.mod = mod; | 1220 | mod->mkobj.mod = mod; |
1227 | 1221 | ||
1228 | kobject_init(&mod->mkobj.kobj); | 1222 | memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj)); |
1223 | mod->mkobj.kobj.kset = module_kset; | ||
1224 | err = kobject_init_and_add(&mod->mkobj.kobj, &module_ktype, NULL, | ||
1225 | "%s", mod->name); | ||
1226 | if (err) | ||
1227 | kobject_put(&mod->mkobj.kobj); | ||
1229 | 1228 | ||
1230 | /* delay uevent until full sysfs population */ | 1229 | /* delay uevent until full sysfs population */ |
1231 | err = kobject_add(&mod->mkobj.kobj); | ||
1232 | out: | 1230 | out: |
1233 | return err; | 1231 | return err; |
1234 | } | 1232 | } |