wiced: fix find oldest link key entry

This commit is contained in:
Matthias Ringwald 2016-09-29 11:11:30 +02:00
parent 8cd22e56c3
commit 4a515d8e5d

View File

@ -131,9 +131,10 @@ static int link_key_find_free_entry(void){
for (i=0;i<NVM_NUM_LINK_KEYS;i++){
link_key_read(i, &item);
if (item.magic != LINK_KEY_MAGIC) return i;
if ((lowest_index != -1) && (item.seq_nr < seq_nr)) continue;
lowest_index = i;
seq_nr= item.seq_nr;
if ((lowest_index < 0) || (item.seq_nr < seq_nr)){
lowest_index = i;
seq_nr= item.seq_nr;
}
}
return lowest_index;
}