7548c0
From a1af99a1129058f2aa312e3c9d125f5bc7693912 Mon Sep 17 00:00:00 2001
7548c0
Message-Id: <a1af99a1129058f2aa312e3c9d125f5bc7693912@dist-git>
7548c0
From: Michal Privoznik <mprivozn@redhat.com>
7548c0
Date: Wed, 7 Oct 2020 18:45:37 +0200
7548c0
Subject: [PATCH] numa_conf: Make virDomainNumaSetNodeCpumask() return void
7548c0
MIME-Version: 1.0
7548c0
Content-Type: text/plain; charset=UTF-8
7548c0
Content-Transfer-Encoding: 8bit
7548c0
7548c0
There is only one caller of virDomainNumaSetNodeCpumask() which
7548c0
checks for the return value but because the function will return
7548c0
NULL iff the @cpumask was NULL in the first place. But in that
7548c0
place @cpumask can't be NULL because it was just allocated by
7548c0
virBitmapParse().
7548c0
7548c0
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7548c0
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
7548c0
(cherry picked from commit 1050c6beb1f2238cd847d93eab17d658720b08e1)
7548c0
7548c0
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1749518
7548c0
7548c0
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7548c0
Message-Id: <8564849f4fc4aaca69eec3d2b7e59d03234ea39f.1602087923.git.mprivozn@redhat.com>
7548c0
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7548c0
---
7548c0
 src/conf/numa_conf.c | 4 +---
7548c0
 src/conf/numa_conf.h | 6 +++---
7548c0
 src/libxl/xen_xl.c   | 4 ++--
7548c0
 3 files changed, 6 insertions(+), 8 deletions(-)
7548c0
7548c0
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
7548c0
index 38fcf9d9aa..c9cc8ac22e 100644
7548c0
--- a/src/conf/numa_conf.c
7548c0
+++ b/src/conf/numa_conf.c
7548c0
@@ -1318,14 +1318,12 @@ virDomainNumaGetNodeCpumask(virDomainNumaPtr numa,
7548c0
 }
7548c0
 
7548c0
 
7548c0
-virBitmapPtr
7548c0
+void
7548c0
 virDomainNumaSetNodeCpumask(virDomainNumaPtr numa,
7548c0
                             size_t node,
7548c0
                             virBitmapPtr cpumask)
7548c0
 {
7548c0
     numa->mem_nodes[node].cpumask = cpumask;
7548c0
-
7548c0
-    return numa->mem_nodes[node].cpumask;
7548c0
 }
7548c0
 
7548c0
 
7548c0
diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h
7548c0
index ce865cbfbb..6808439a7c 100644
7548c0
--- a/src/conf/numa_conf.h
7548c0
+++ b/src/conf/numa_conf.h
7548c0
@@ -156,9 +156,9 @@ size_t virDomainNumaSetNodeDistanceCount(virDomainNumaPtr numa,
7548c0
                                          size_t ndistances)
7548c0
     ATTRIBUTE_NONNULL(1);
7548c0
 
7548c0
-virBitmapPtr virDomainNumaSetNodeCpumask(virDomainNumaPtr numa,
7548c0
-                                         size_t node,
7548c0
-                                         virBitmapPtr cpumask)
7548c0
+void  virDomainNumaSetNodeCpumask(virDomainNumaPtr numa,
7548c0
+                                  size_t node,
7548c0
+                                  virBitmapPtr cpumask)
7548c0
     ATTRIBUTE_NONNULL(1);
7548c0
 
7548c0
 /*
7548c0
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
7548c0
index 91b1825399..edea30a86a 100644
7548c0
--- a/src/libxl/xen_xl.c
7548c0
+++ b/src/libxl/xen_xl.c
7548c0
@@ -508,10 +508,10 @@ xenParseXLVnuma(virConfPtr conf,
7548c0
                             goto cleanup;
7548c0
                         }
7548c0
 
7548c0
-                        if ((virBitmapParse(vtoken, &cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0) ||
7548c0
-                            (virDomainNumaSetNodeCpumask(numa, vnodeCnt, cpumask) == NULL))
7548c0
+                        if (virBitmapParse(vtoken, &cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
7548c0
                             goto cleanup;
7548c0
 
7548c0
+                        virDomainNumaSetNodeCpumask(numa, vnodeCnt, cpumask);
7548c0
                         vcpus += virBitmapCountBits(cpumask);
7548c0
 
7548c0
                     } else if (STRPREFIX(str, "vdistances")) {
7548c0
-- 
7548c0
2.29.2
7548c0