From e3da5c3d390f2c2a9c0f470df7456947ad188c30 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 12 Aug 2024 15:42:10 +0200 Subject: [PATCH] Bluetooth: Mesh: Fix build warning with gcc 13 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gcc 13 thinks max_adv_duration may be used unitialized and warns accordingly (see below) It seems the reason is the goto, which confuses it. In any case, pacifying this warning is trivial, so let's just do so. The warning: ``` In function ‘gatt_proxy_advertise’, inlined from ‘bt_mesh_proxy_adv_start’ at subsys/bluetooth/mesh/proxy_srv.c:1214:9: subsys/bluetooth/mesh/proxy_srv.c:842:44: error: ‘max_adv_duration’ may be used uninitialized [-Werror=maybe-uninitialized] subsys/bluetooth/mesh/proxy_srv.c: In function ‘bt_mesh_proxy_adv_start’ zephyr/subsys/bluetooth/mesh/proxy_srv.c:786:17: note: ‘max_adv_duration’ was declared here 786 | int32_t max_adv_duration; | ^~~~~~~~~~~~~~~~ ``` Signed-off-by: Alberto Escolar Piedras --- subsys/bluetooth/mesh/proxy_srv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/proxy_srv.c b/subsys/bluetooth/mesh/proxy_srv.c index ca5e8bb76d1..f17e98f11d2 100644 --- a/subsys/bluetooth/mesh/proxy_srv.c +++ b/subsys/bluetooth/mesh/proxy_srv.c @@ -783,7 +783,7 @@ static int gatt_proxy_advertise(void) { int err; - int32_t max_adv_duration; + int32_t max_adv_duration = 0; int cnt; struct bt_mesh_subnet *sub; struct proxy_adv_request request;