-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
If you do a 'make clang-check', currently there are some dead assignments reported, which i dig a bit into.
Usually we int ret = -1, use it to capture return values, do error handling.
But this pattern is inconsistent, and this uncovered some issues with error handling.
- Capture the return value but skip error handling, neither return the error value:
/* api/src/glfs-handleops.c */
struct glfs_object *
pub_glfs_h_lookupat(struct glfs *fs, struct glfs_object *parent,
const char *path, struct stat *stat, int follow)
{
int ret = 0;
(...)
/* populate out args */
if (!ret) {
if (stat)
glfs_iatt_to_stat(fs, &iatt, stat);
ret = glfs_create_object(&loc, &object); /* <-- Value stored to 'ret' is never read */
}
(....)
}/* api/src/glfs-handleops.c */
struct glfs_object *
glfs_h_resolve_symlink(struct glfs *fs, struct glfs_object *object)
{
(...)
int ret = 0;
(...)
if (ret == 0)
ret = glfs_create_object(&sym_loc, &target_object); /* W: Variable 'ret' is assigned a value that is never used. */
(....)
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels