]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
plugins: fix -Werror=maybe-uninitialized false-positive
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Fri, 15 Nov 2024 12:18:13 +0000 (16:18 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 3 Feb 2025 17:16:07 +0000 (21:16 +0400)
../contrib/plugins/cache.c:638:9: error: ‘l2_cache’ may be used uninitialized [-Werror=maybe-uninitialized]
  638 |         append_stats_line(rep, l1_dmem_accesses, l1_dmisses,
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Is a false-positive, since cores > 1, so the variable is set in the
above loop.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
contrib/plugins/cache.c

index 7baff868609ec49f3b23990922bb37b6e3c2a55b..7cfd3df249e498c7c56a02ca84af079c4edfd235 100644 (file)
@@ -603,7 +603,7 @@ static int l2_cmp(gconstpointer a, gconstpointer b)
 static void log_stats(void)
 {
     int i;
-    Cache *icache, *dcache, *l2_cache;
+    Cache *icache, *dcache, *l2_cache = NULL;
 
     g_autoptr(GString) rep = g_string_new("core #, data accesses, data misses,"
                                           " dmiss rate, insn accesses,"