From f369797617297e190e2fba3d1b7ba459580f619c Mon Sep 17 00:00:00 2001 From: Chen Qun Date: Wed, 18 Nov 2020 19:56:45 +0800 Subject: [PATCH] tests/qtest: variable defined by g_autofree need to be initialized MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to the glib function requirements, we need initialise the variable. Otherwise there will be compilation warnings: glib-autocleanups.h:28:3: warning: ‘full_name’ may be used uninitialized in this function [-Wmaybe-uninitialized] 28 | g_free (*pp); | ^~~~~~~~~~~~ Reported-by: Euler Robot Signed-off-by: Chen Qun Reviewed-by: Thomas Huth Reviewed-by: Havard Skinnemoen Message-Id: <20201118115646.2461726-2-kuhn.chenqun@huawei.com> Signed-off-by: Thomas Huth --- tests/qtest/npcm7xx_timer-test.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/qtest/npcm7xx_timer-test.c b/tests/qtest/npcm7xx_timer-test.c index f08b0cd62a..83774a5b90 100644 --- a/tests/qtest/npcm7xx_timer-test.c +++ b/tests/qtest/npcm7xx_timer-test.c @@ -512,11 +512,9 @@ static void test_disable_on_expiration(gconstpointer test_data) */ static void tim_add_test(const char *name, const TestData *td, GTestDataFunc fn) { - g_autofree char *full_name; - - full_name = g_strdup_printf("npcm7xx_timer/tim[%d]/timer[%d]/%s", - tim_index(td->tim), timer_index(td->timer), - name); + g_autofree char *full_name = g_strdup_printf( + "npcm7xx_timer/tim[%d]/timer[%d]/%s", tim_index(td->tim), + timer_index(td->timer), name); qtest_add_data_func(full_name, td, fn); }