[dpdk-dev,2/3] memalloc: fix wrong return value on freeing segment on fail

Message ID f612ef58f4a92ccff88565f1cc8c9483ad69bab0.1525342009.git.anatoly.burakov@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Anatoly Burakov May 3, 2018, 10:11 a.m. UTC
  Return value should be zero for success, but if unlock and unlink
have succeeded, return value was 1, which triggered failure message
in calling code.

Fixes: a5ff05d60fc5 ("mem: support unmapping pages at runtime")
Cc: anatoly.burakov@intel.com

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_memalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ananyev, Konstantin May 10, 2018, 4:03 p.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Anatoly Burakov
> Sent: Thursday, May 3, 2018 11:11 AM
> To: dev@dpdk.org
> Cc: Liu, Yong <yong.liu@intel.com>; Burakov, Anatoly <anatoly.burakov@intel.com>
> Subject: [dpdk-dev] [PATCH 2/3] memalloc: fix wrong return value on freeing segment on fail
> 
> Return value should be zero for success, but if unlock and unlink
> have succeeded, return value was 1, which triggered failure message
> in calling code.
> 
> Fixes: a5ff05d60fc5 ("mem: support unmapping pages at runtime")
> Cc: anatoly.burakov@intel.com
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
  

Patch

diff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c
index c441c89..3282293 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memalloc.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memalloc.c
@@ -647,7 +647,7 @@  free_seg(struct rte_memseg *ms, struct hugepage_info *hi,
 
 	memset(ms, 0, sizeof(*ms));
 
-	return ret;
+	return ret < 0 ? -1 : 0;
 }
 
 struct alloc_walk_param {