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.
This commit is contained in:
Michał Narajowski
2019-01-31 17:50:26 +01:00
parent 4f1dbf88d8
commit 2bcb0ddbf4
-7
View File
@@ -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);