--- zzzz-none-000/linux-3.10.107/drivers/firmware/dmi-sysfs.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/firmware/dmi-sysfs.c 2021-02-04 17:41:59.000000000 +0000 @@ -553,7 +553,7 @@ static void dmi_sysfs_entry_release(struct kobject *kobj) { struct dmi_sysfs_entry *entry = to_entry(kobj); - sysfs_remove_bin_file(&entry->kobj, &dmi_entry_raw_attr); + spin_lock(&entry_list_lock); list_del(&entry->list); spin_unlock(&entry_list_lock); @@ -566,7 +566,6 @@ .default_attrs = dmi_sysfs_entry_attrs, }; -static struct kobject *dmi_kobj; static struct kset *dmi_kset; /* Global count of all instances seen. Only for setup */ @@ -648,17 +647,20 @@ static int __init dmi_sysfs_init(void) { - int error = -ENOMEM; + int error; int val; - /* Set up our directory */ - dmi_kobj = kobject_create_and_add("dmi", firmware_kobj); - if (!dmi_kobj) + if (!dmi_kobj) { + pr_err("dmi-sysfs: dmi entry is absent.\n"); + error = -ENODATA; goto err; + } dmi_kset = kset_create_and_add("entries", NULL, dmi_kobj); - if (!dmi_kset) + if (!dmi_kset) { + error = -ENOMEM; goto err; + } val = 0; error = dmi_walk(dmi_sysfs_register_handle, &val); @@ -675,7 +677,6 @@ err: cleanup_entry_list(); kset_unregister(dmi_kset); - kobject_put(dmi_kobj); return error; } @@ -685,7 +686,6 @@ pr_debug("dmi-sysfs: unloading.\n"); cleanup_entry_list(); kset_unregister(dmi_kset); - kobject_put(dmi_kobj); } module_init(dmi_sysfs_init);