diff options
author | Mike Snitzer <snitzer@redhat.com> | 2017-11-06 16:40:10 -0500 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2017-11-10 15:44:57 -0500 |
commit | 49de5769702cdf997e87359ba4e9ae289c1044e0 (patch) | |
tree | 20f07a1306a18bafb27ec780ff28a3aac8190cbe | |
parent | b9a41d21dceadf8104812626ef85dc56ee8a60ed (diff) |
dm: small cleanup in dm_get_md()
Makes dm_get_md() and dm_get_from_kobject() have similar code.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r-- | drivers/md/dm.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index dcfa1a8c9390..567b9ed1056d 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2074,17 +2074,12 @@ struct mapped_device *dm_get_md(dev_t dev) spin_lock(&_minor_lock); md = idr_find(&_minor_idr, minor); - if (md) { - if ((md == MINOR_ALLOCED || - (MINOR(disk_devt(dm_disk(md))) != minor) || - dm_deleting_md(md) || - test_bit(DMF_FREEING, &md->flags))) { - md = NULL; - goto out; - } - dm_get(md); + if (!md || md == MINOR_ALLOCED || (MINOR(disk_devt(dm_disk(md))) != minor) || + test_bit(DMF_FREEING, &md->flags) || dm_deleting_md(md)) { + md = NULL; + goto out; } - + dm_get(md); out: spin_unlock(&_minor_lock); |