All of lore.kernel.org
 help / color / mirror / Atom feed
* main - cleanup: simplify condition
@ 2021-03-02 21:58 Zdenek Kabelac
  0 siblings, 0 replies; only message in thread
From: Zdenek Kabelac @ 2021-03-02 21:58 UTC (permalink / raw)
  To: lvm-devel

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1042cd9a612e1f71fda15dac62948707acee326e
Commit:        1042cd9a612e1f71fda15dac62948707acee326e
Parent:        eb3dcc72eb0e1f3922dafcc4d018db70aabc3bc9
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Sat Feb 27 21:18:48 2021 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Tue Mar 2 22:57:35 2021 +0100

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;
 }
 



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-02 21:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 21:58 main - cleanup: simplify condition Zdenek Kabelac

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.