Bluetooth: Mesh: RPR cli @ mod elem 0 check

Add check to the Remote Provisioning Client model init call
that verifies that the model is located at the root element.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
This commit is contained in:
Anders Storrø 2023-03-22 09:43:29 +01:00 committed by Carles Cufí
commit 09a32928aa

View file

@ -372,6 +372,12 @@ static void link_timeout(struct k_work *work)
static int rpr_cli_init(struct bt_mesh_model *mod) static int rpr_cli_init(struct bt_mesh_model *mod)
{ {
if (mod->elem_idx) {
LOG_ERR("Remote provisioning client must be initialized "
"on first element");
return -EINVAL;
}
struct bt_mesh_rpr_cli *cli = mod->user_data; struct bt_mesh_rpr_cli *cli = mod->user_data;
cli->mod = mod; cli->mod = mod;