From f23e808ed03d6e4cb696e52893cff806447f70dd Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 26 Jun 2018 11:32:40 +0300 Subject: [PATCH] Bluetooth: Mesh: Fix redundant model publication clearing If the model publication is not enabled, we should return success, however no other steps need to be done. This also helps avoid writing redundant entries to flash when resetting a node that never had model publication enabled. Signed-off-by: Johan Hedberg --- subsys/bluetooth/host/mesh/cfg_srv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/bluetooth/host/mesh/cfg_srv.c b/subsys/bluetooth/host/mesh/cfg_srv.c index 3caafaac404..47a6e4661d0 100644 --- a/subsys/bluetooth/host/mesh/cfg_srv.c +++ b/subsys/bluetooth/host/mesh/cfg_srv.c @@ -260,6 +260,10 @@ static u8_t _mod_pub_set(struct bt_mesh_model *model, u16_t pub_addr, } if (pub_addr == BT_MESH_ADDR_UNASSIGNED) { + if (model->pub->addr == BT_MESH_ADDR_UNASSIGNED) { + return STATUS_SUCCESS; + } + model->pub->addr = BT_MESH_ADDR_UNASSIGNED; model->pub->key = 0; model->pub->cred = 0;