From 1042cd9a612e1f71fda15dac62948707acee326e Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Sat, 27 Feb 2021 21:18:48 +0100 Subject: [PATCH] cleanup: simplify condition --- lib/device/dev-cache.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c index bbf6ce833..5632456bf 100644 --- a/lib/device/dev-cache.c +++ b/lib/device/dev-cache.c @@ -1563,9 +1563,6 @@ struct device *dev_cache_get_by_devt(struct cmd_context *cmd, dev_t dev, struct if (filtered) *filtered = 0; - if (d && (d->flags & DEV_REGULAR)) - return d; - if (!d) { sysfs_dir = dm_sysfs_dir(); if (sysfs_dir && *sysfs_dir) { @@ -1587,10 +1584,10 @@ struct device *dev_cache_get_by_devt(struct cmd_context *cmd, dev_t dev, struct (int)MAJOR(dev), (int)MINOR(dev)); dev_cache_scan(); d = (struct device *) btree_lookup(_cache.devices, (uint32_t) dev); - } - if (!d) - return NULL; + if (!d) + return NULL; + } if (d->flags & DEV_REGULAR) return d; @@ -1611,6 +1608,7 @@ struct device *dev_cache_get_by_devt(struct cmd_context *cmd, dev_t dev, struct if (filtered) *filtered = 1; + return NULL; } -- 2.43.5