Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ddd641d authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Mike Snitzer
Browse files

dm: remove pointless kobject comparison in dm_get_from_kobject



The comparison is always true and the compiler optimizes it out anyway.

Milan offered additional context relative to the original commit
784aae73 ("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: default avatarMikulas Patocka <mpatocka@redhat.com>
Acked-by: default avatarMilan Broz <gmazyland@gmail.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent c1a64160
Loading
Loading
Loading
Loading
+0 −6
Original line number Original line Diff line number Diff line
@@ -2905,17 +2905,11 @@ struct kobject *dm_kobject(struct mapped_device *md)
	return &md->kobj;
	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 *dm_get_from_kobject(struct kobject *kobj)
{
{
	struct mapped_device *md;
	struct mapped_device *md;


	md = container_of(kobj, struct mapped_device, kobj);
	md = container_of(kobj, struct mapped_device, kobj);
	if (&md->kobj != kobj)
		return NULL;


	if (test_bit(DMF_FREEING, &md->flags) ||
	if (test_bit(DMF_FREEING, &md->flags) ||
	    dm_deleting_md(md))
	    dm_deleting_md(md))