[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] xen/cpupools: silence maybe-unitialized warning



commit 1adc5fbfa6627da352f97d84a8a752084da4419f
Author:     Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
AuthorDate: Tue Jul 30 11:52:03 2024 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Jul 30 11:52:03 2024 +0200

    xen/cpupools: silence maybe-unitialized warning
    
    When building with gcc with -finstrument-functions, optimization level
    -O1, CONFIG_HYPFS=y and # CONFIG_HAS_SCHED_GRANULARITY is not set, the
    the following build warning (error) is encountered:
    
    common/sched/cpupool.c: In function â??cpupool_gran_writeâ??:
    common/sched/cpupool.c:1220:26: error: â??granâ?? may be used uninitialized 
[-Werror=maybe-uninitialized]
     1220 |                      0 : cpupool_check_granularity(gran);
          |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    common/sched/cpupool.c:1207:21: note: â??granâ?? declared here
     1207 |     enum sched_gran gran;
          |                     ^~~~
    
    This is a false positive. Silence the warning (error) by initializing
    the variable.
    
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
    Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
---
 xen/common/sched/cpupool.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c
index 57dfee26f2..3d02c7b706 100644
--- a/xen/common/sched/cpupool.c
+++ b/xen/common/sched/cpupool.c
@@ -103,6 +103,7 @@ custom_param("sched-gran", sched_select_granularity);
 #elif defined(CONFIG_HYPFS)
 static int sched_gran_get(const char *str, enum sched_gran *mode)
 {
+    *mode = SCHED_GRAN_cpu;
     return -EINVAL;
 }
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.