dm: remove pointless kobject comparison in dm_get_from_kobject
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 7 Jan 2014 03:53:28 +0000 (22:53 -0500)
committerMike Snitzer <snitzer@redhat.com>
Tue, 7 Jan 2014 18:22:32 +0000 (13:22 -0500)
The comparison is always true and the compiler optimizes it out anyway.

Milan offered additional context relative to the original commit
784aae735d ("dm: add name and uuid to sysfs") which introduced the code:
"I think it is just relict of some experiments before I committed this
simple embedded sysfs kobj handling".

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Acked-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm.c

index 0704c523a76b98e41413599aa2707e0f16eeb25a..b3d937211a488f404bee33a3ac5eca46793830b1 100644 (file)
@@ -2905,17 +2905,11 @@ struct kobject *dm_kobject(struct mapped_device *md)
        return &md->kobj;
 }
 
-/*
- * struct mapped_device should not be exported outside of dm.c
- * so use this check to verify that kobj is part of md structure
- */
 struct mapped_device *dm_get_from_kobject(struct kobject *kobj)
 {
        struct mapped_device *md;
 
        md = container_of(kobj, struct mapped_device, kobj);
-       if (&md->kobj != kobj)
-               return NULL;
 
        if (test_bit(DMF_FREEING, &md->flags) ||
            dm_deleting_md(md))