]> err.no Git - linux-2.6/commitdiff
Driver: remove redundant kobject_unregister checks
authorMariusz Kozlowski <m.kozlowski@tuxland.pl>
Wed, 14 Feb 2007 20:03:39 +0000 (21:03 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 16 Feb 2007 23:19:17 +0000 (15:19 -0800)
Here is a patch that removes all redundant kobject_unregister argument checks.

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/class.c
fs/partitions/check.c
kernel/module.c

index 96def1ddba194b50347b171f221fbdfadbd896f5..1417e5cd4c6f539544ebc686a81d7b51592e0331 100644 (file)
@@ -163,8 +163,7 @@ int class_register(struct class * cls)
 void class_unregister(struct class * cls)
 {
        pr_debug("device class '%s': unregistering\n", cls->name);
-       if (cls->virtual_dir)
-               kobject_unregister(cls->virtual_dir);
+       kobject_unregister(cls->virtual_dir);
        remove_class_attrs(cls);
        subsystem_unregister(&cls->subsys);
 }
index ac32a2e8540c4fb2ac34c1c27286f1a0d624fbd1..22d38ffc9ef0b892c65e8c380f6f6682bacb398a 100644 (file)
@@ -358,8 +358,7 @@ void delete_partition(struct gendisk *disk, int part)
        p->ios[0] = p->ios[1] = 0;
        p->sectors[0] = p->sectors[1] = 0;
        sysfs_remove_link(&p->kobj, "subsystem");
-       if (p->holder_dir)
-               kobject_unregister(p->holder_dir);
+       kobject_unregister(p->holder_dir);
        kobject_uevent(&p->kobj, KOBJ_REMOVE);
        kobject_del(&p->kobj);
        kobject_put(&p->kobj);
@@ -603,10 +602,8 @@ void del_gendisk(struct gendisk *disk)
        disk->stamp = 0;
 
        kobject_uevent(&disk->kobj, KOBJ_REMOVE);
-       if (disk->holder_dir)
-               kobject_unregister(disk->holder_dir);
-       if (disk->slave_dir)
-               kobject_unregister(disk->slave_dir);
+       kobject_unregister(disk->holder_dir);
+       kobject_unregister(disk->slave_dir);
        if (disk->driverfs_dev) {
                char *disk_name = make_block_name(disk);
                sysfs_remove_link(&disk->kobj, "device");
index 225501f620ff2bf4ef7b63fdcc1bbd585f85b9bc..e06b77af23fd2e3dc7b16a5ad90088b171ba854f 100644 (file)
@@ -1180,11 +1180,8 @@ static void mod_kobject_remove(struct module *mod)
 {
        module_remove_modinfo_attrs(mod);
        module_param_sysfs_remove(mod);
-       if (mod->mkobj.drivers_dir)
-               kobject_unregister(mod->mkobj.drivers_dir);
-       if (mod->holders_dir)
-               kobject_unregister(mod->holders_dir);
-
+       kobject_unregister(mod->mkobj.drivers_dir);
+       kobject_unregister(mod->holders_dir);
        kobject_unregister(&mod->mkobj.kobj);
 }