From 0cf4069c27ab4e609994c4891fa6ce72572ed9f2 Mon Sep 17 00:00:00 2001 From: Tomasz Gromadzki Date: Tue, 24 Oct 2023 14:16:26 +0200 Subject: [PATCH] common: remove redundant errno assignment Signed-off-by: Tomasz Gromadzki --- src/libpmem2/deep_flush_linux.c | 1 - src/libpmem2/pmem2_utils_linux.c | 6 ++---- src/libpmem2/region_namespace_ndctl.c | 2 -- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/libpmem2/deep_flush_linux.c b/src/libpmem2/deep_flush_linux.c index 251e626f113..cb5a1ec785a 100644 --- a/src/libpmem2/deep_flush_linux.c +++ b/src/libpmem2/deep_flush_linux.c @@ -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; } diff --git a/src/libpmem2/pmem2_utils_linux.c b/src/libpmem2/pmem2_utils_linux.c index e6a5a8c09d6..d26cf987dae 100644 --- a/src/libpmem2/pmem2_utils_linux.c +++ b/src/libpmem2/pmem2_utils_linux.c @@ -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; } @@ -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; @@ -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; } diff --git a/src/libpmem2/region_namespace_ndctl.c b/src/libpmem2/region_namespace_ndctl.c index b450a00a86f..7928cffc0d2 100644 --- a/src/libpmem2/region_namespace_ndctl.c +++ b/src/libpmem2/region_namespace_ndctl.c @@ -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; @@ -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; }