1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cov: check _insert_dev return value

Although we try later to validate device was inserted,
we can validate return value and early-exit.
This commit is contained in:
Zdenek Kabelac 2021-04-22 12:30:26 +02:00
parent d7237ca63a
commit 7e13586837

View File

@ -1510,7 +1510,8 @@ struct device *dev_cache_get(struct cmd_context *cmd, const char *name, struct d
* for st_rdev.
*/
if (!dev) {
_insert_dev(name, st.st_rdev);
if (!_insert_dev(name, st.st_rdev))
return_NULL;
/* Get the struct dev that was just added. */
dev = (struct device *) dm_hash_lookup(_cache.names, name);