diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c index 8082efac4..a93600965 100644 --- a/lib/device/dev-cache.c +++ b/lib/device/dev-cache.c @@ -337,6 +337,11 @@ static int _add_alias(struct device *dev, const char *path) return 1; } + if (!strncmp(path, "/dev/nvme", 9)) { + log_debug("Found nvme device %s", dev_name(dev)); + dev->flags |= DEV_IS_NVME; + } + sl->str = path; if (!dm_list_empty(&dev->aliases)) { diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c index 379afa89c..8eacbf096 100644 --- a/lib/device/dev-type.c +++ b/lib/device/dev-type.c @@ -78,19 +78,7 @@ int dev_is_pmem(struct device *dev) int dev_is_nvme(struct dev_types *dt, struct device *dev) { - struct dm_str_list *strl; - - if (dev->flags & DEV_IS_NVME) - return 1; - - dm_list_iterate_items(strl, &dev->aliases) { - if (!strncmp(strl->str, "/dev/nvme", 9)) { - log_debug("Found nvme device %s", dev_name(dev)); - dev->flags |= DEV_IS_NVME; - return 1; - } - } - return 0; + return (dev->flags & DEV_IS_NVME) ? 1 : 0; } int dev_is_lv(struct device *dev)