From 2bcb0ddbf4d52267dd1be42bc8824dc2604faf7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Wed, 30 Jan 2019 14:45:00 +0100 Subject: [PATCH] mesh: Fix checking for subnet when recovering App Key The ordering of items in flash is not guaranteed, so it's possible we get an App Key before the corresponding Net Key. Remove the check for a Net Key, since the storing code should never store an App Key if there is no corresponding Net Key. --- nimble/host/mesh/src/settings.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/nimble/host/mesh/src/settings.c b/nimble/host/mesh/src/settings.c index 72ae1720f..0f75c305c 100644 --- a/nimble/host/mesh/src/settings.c +++ b/nimble/host/mesh/src/settings.c @@ -380,7 +380,6 @@ static int net_key_set(int argc, char **argv, char *val) static int app_key_set(int argc, char **argv, char *val) { struct bt_mesh_app_key *app; - struct bt_mesh_subnet *sub; struct app_key_val key; u16_t app_idx; int len, err; @@ -412,12 +411,6 @@ static int app_key_set(int argc, char **argv, char *val) return -EINVAL; } - sub = bt_mesh_subnet_get(key.net_idx); - if (!sub) { - BT_ERR("Failed to find subnet 0x%03x", key.net_idx); - return -ENOENT; - } - app = bt_mesh_app_key_find(app_idx); if (!app) { app = bt_mesh_app_key_alloc(app_idx);