Skip to content

Commit

Permalink
dm: remove pointless kobject comparison in dm_get_from_kobject
Browse files Browse the repository at this point in the history
The comparison is always true and the compiler optimizes it out anyway.

Milan offered additional context relative to the original commit
784aae7 ("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>
  • Loading branch information
Mikulas Patocka authored and Mike Snitzer committed Jan 7, 2014
1 parent c1a6416 commit 1ddd641
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 1ddd641

Please sign in to comment.