The statement 'return ERR_PTR(-ENOENT);' on the final line of the function
'hypfs_get_entry_rel()' is unreachable because the logic within the infinite
loop 'for (;;)' provides all possible exit paths for the function. So there
is no execution path to exit the loop and reach the final that statement.
Remove that statement. This also fixes MISRA C Rule 2.1 which states:
"A project shall not contain unreachable code".
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
---
Test CI pipeline:
https://gitlab.com/xen-project/people/dimaprkp4k/xen/-/pipelines/2440991088
---
xen/common/hypfs.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/xen/common/hypfs.c b/xen/common/hypfs.c
index cdf4ee0171..fea74d66e1 100644
--- a/xen/common/hypfs.c
+++ b/xen/common/hypfs.c
@@ -347,8 +347,6 @@ static struct hypfs_entry *hypfs_get_entry_rel(struct hypfs_entry_dir *dir,
path = end + 1;
dir = container_of(entry, struct hypfs_entry_dir, e);
}
-
- return ERR_PTR(-ENOENT);
}
static struct hypfs_entry *hypfs_get_entry(const char *path)
--
2.43.0