diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 681c2dd0a..3e5bd5dcb 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -1778,12 +1778,9 @@ struct pv_list *find_pv_in_vg(const struct volume_group *vg, const char *pv_name) { struct pv_list *pvl; - struct device *pv_dev, *cached_dev; dm_list_iterate_items(pvl, &vg->pvs) { - pv_dev = pvl->pv->dev; - cached_dev = dev_cache_get(pv_name, vg->cmd->filter); - if (!pv_dev) { + if (!pvl->pv->dev) { /* * pv_dev can't be NULL here! * We have to catch this situation earlier in the @@ -1800,10 +1797,10 @@ struct pv_list *find_pv_in_vg(const struct volume_group *vg, * handled earlier in the code in that case. */ log_error(INTERNAL_ERROR "find_pv_in_vg: PV that is not " - "bound to any existing device found"); + "bound to any existing device found."); return NULL; } - if (pv_dev == cached_dev) + if (pvl->pv->dev == dev_cache_get(pv_name, vg->cmd->filter)) return pvl; }