mm/memory-failure: send SIGBUS(BUS_MCEERR_AR) only to current thread
[linux-2.6-microblaze.git] / lib / kobject.c
index 65fa7bf..1e4b738 100644 (file)
@@ -620,6 +620,13 @@ void kobject_del(struct kobject *kobj)
        if (ktype)
                sysfs_remove_groups(kobj, ktype->default_groups);
 
+       /* send "remove" if the caller did not do it but sent "add" */
+       if (kobj->state_add_uevent_sent && !kobj->state_remove_uevent_sent) {
+               pr_debug("kobject: '%s' (%p): auto cleanup 'remove' event\n",
+                        kobject_name(kobj), kobj);
+               kobject_uevent(kobj, KOBJ_REMOVE);
+       }
+
        sysfs_remove_dir(kobj);
        sysfs_put(sd);
 
@@ -673,13 +680,6 @@ static void kobject_cleanup(struct kobject *kobj)
                pr_debug("kobject: '%s' (%p): does not have a release() function, it is broken and must be fixed. See Documentation/core-api/kobject.rst.\n",
                         kobject_name(kobj), kobj);
 
-       /* send "remove" if the caller did not do it but sent "add" */
-       if (kobj->state_add_uevent_sent && !kobj->state_remove_uevent_sent) {
-               pr_debug("kobject: '%s' (%p): auto cleanup 'remove' event\n",
-                        kobject_name(kobj), kobj);
-               kobject_uevent(kobj, KOBJ_REMOVE);
-       }
-
        /* remove from sysfs if the caller did not do it */
        if (kobj->state_in_sysfs) {
                pr_debug("kobject: '%s' (%p): auto cleanup kobject_del\n",