From bb5ce8ae30e5e44bb2c337988e08e1c90c42f40e Mon Sep 17 00:00:00 2001 From: chao an Date: Mon, 25 May 2020 20:55:38 +0800 Subject: [PATCH] Bluetooth: Mesh: fix shadow declare CC: mesh/adv.c mesh/adv.c: In function 'bt_mesh_scan_cb': mesh/adv.c:247:13: warning: declaration of 'adv_type' shadows a global declaration [-Wshadow] 247 | u8_t adv_type, struct net_buf_simple *buf) | ~~~~~^~~~~~~~ mesh/adv.c:58:19: note: shadowed declaration is here 58 | static const u8_t adv_type[] = { | ^~~~~~~~ CC: mesh/prov.c mesh/prov.c: In function 'bt_mesh_prov_enable': mesh/prov.c:1203:30: warning: declaration of 'prov' shadows a global declaration [-Wshadow] 1203 | const struct bt_mesh_prov *prov = bt_mesh_prov_get(); | ^~~~ mesh/prov.c:129:35: note: shadowed declaration is here 129 | static const struct bt_mesh_prov *prov; | ^~~~ Signed-off-by: chao an --- subsys/bluetooth/mesh/adv.c | 13 ++++++------- subsys/bluetooth/mesh/prov.c | 1 - 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/subsys/bluetooth/mesh/adv.c b/subsys/bluetooth/mesh/adv.c index 70242a58862..ddaa0d5e54d 100644 --- a/subsys/bluetooth/mesh/adv.c +++ b/subsys/bluetooth/mesh/adv.c @@ -55,13 +55,6 @@ static K_FIFO_DEFINE(adv_queue); static struct k_thread adv_thread_data; static K_THREAD_STACK_DEFINE(adv_thread_stack, ADV_STACK_SIZE); -static const u8_t adv_type[] = { - [BT_MESH_ADV_PROV] = BT_DATA_MESH_PROV, - [BT_MESH_ADV_DATA] = BT_DATA_MESH_MESSAGE, - [BT_MESH_ADV_BEACON] = BT_DATA_MESH_BEACON, - [BT_MESH_ADV_URI] = BT_DATA_URI, -}; - NET_BUF_POOL_DEFINE(adv_buf_pool, CONFIG_BT_MESH_ADV_BUF_COUNT, BT_MESH_ADV_DATA_SIZE, BT_MESH_ADV_USER_DATA_SIZE, NULL); @@ -91,6 +84,12 @@ static inline void adv_send_end(int err, const struct bt_mesh_send_cb *cb, static inline void adv_send(struct net_buf *buf) { + static const u8_t adv_type[] = { + [BT_MESH_ADV_PROV] = BT_DATA_MESH_PROV, + [BT_MESH_ADV_DATA] = BT_DATA_MESH_MESSAGE, + [BT_MESH_ADV_BEACON] = BT_DATA_MESH_BEACON, + [BT_MESH_ADV_URI] = BT_DATA_URI, + }; const s32_t adv_int_min = ((bt_dev.hci_version >= BT_HCI_VERSION_5_0) ? ADV_INT_FAST_MS : ADV_INT_DEFAULT_MS); const struct bt_mesh_send_cb *cb = BT_MESH_ADV(buf)->cb; diff --git a/subsys/bluetooth/mesh/prov.c b/subsys/bluetooth/mesh/prov.c index 7521562dcd9..08e85beb8d3 100644 --- a/subsys/bluetooth/mesh/prov.c +++ b/subsys/bluetooth/mesh/prov.c @@ -1199,7 +1199,6 @@ int bt_mesh_prov_enable(bt_mesh_prov_bearer_t bearers) } if (IS_ENABLED(CONFIG_BT_DEBUG)) { - const struct bt_mesh_prov *prov = bt_mesh_prov_get(); struct bt_uuid_128 uuid = { .uuid = { BT_UUID_TYPE_128 } }; memcpy(uuid.val, prov->uuid, 16);