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 <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2018-06-26 11:32:40 +03:00 committed by Johan Hedberg
commit f23e808ed0

View file

@ -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 (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->addr = BT_MESH_ADDR_UNASSIGNED;
model->pub->key = 0; model->pub->key = 0;
model->pub->cred = 0; model->pub->cred = 0;