Skip to content

Commit

Permalink
common: remove redundant errno assignment
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Gromadzki <tomasz.gromadzki@intel.com>
  • Loading branch information
grom72 committed Oct 24, 2023
1 parent fbb9d96 commit 0cf4069
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/libpmem2/deep_flush_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ pmem2_deep_flush_write(unsigned region_id)
deep_flush_path = Malloc(PATH_MAX * sizeof(char));
if (deep_flush_path == NULL) {
ERR("!Malloc");
errno = ENOMEM;
ret = PMEM2_E_ERRNO;
goto end;
}
Expand Down
6 changes: 2 additions & 4 deletions src/libpmem2/pmem2_utils_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ pmem2_get_type_from_stat(const os_stat_t *st, enum pmem2_file_type *type)

spath = Malloc(PATH_MAX * sizeof(char));
if (spath == NULL) {
errno = ENOMEM;
ERR("!Malloc");
return PMEM2_E_ERRNO;
}
Expand All @@ -65,7 +64,6 @@ pmem2_get_type_from_stat(const os_stat_t *st, enum pmem2_file_type *type)

npath = Malloc(PATH_MAX * sizeof(char));
if (npath == NULL) {
errno = ENOMEM;
ERR("!Malloc");
ret = PMEM2_E_ERRNO;
goto end;
Expand All @@ -88,10 +86,10 @@ pmem2_get_type_from_stat(const os_stat_t *st, enum pmem2_file_type *type)
*type = PMEM2_FTYPE_DEVDAX;

end:
if (spath)
Free(spath);
if (npath)
Free(npath);
if (spath)
Free(spath);

return ret;
}
2 changes: 0 additions & 2 deletions src/libpmem2/region_namespace_ndctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ ndctl_match_devdax(dev_t st_rdev, const char *devname)

path = Malloc(PATH_MAX * sizeof(char));
if (path == NULL) {
errno = ENOMEM;
ERR("!Malloc");
return PMEM2_E_ERRNO;

Expand Down Expand Up @@ -89,7 +88,6 @@ ndctl_match_fsdax(dev_t st_dev, const char *devname)

path = Malloc(PATH_MAX * sizeof(char));
if (path == NULL) {
errno = ENOMEM;
ERR("!Malloc");
return PMEM2_E_ERRNO;
}
Expand Down

0 comments on commit 0cf4069

Please sign in to comment.