Skip to content

Commit 11589ab

Browse files
author
Seppo Takalo
committed
TDBStore: Move Assert to init(), so Block parameter are initialised correctly
1 parent 56067cf commit 11589ab

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

features/storage/kvstore/tdbstore/TDBStore.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,6 @@ TDBStore::TDBStore(BlockDevice *bd) : _ram_table(0), _max_keys(0),
117117
for (int i = 0; i < _max_open_iterators; i++) {
118118
_iterator_table[i] = { 0 };
119119
}
120-
121-
/* Minimum space required by Reserved area and master record */
122-
MBED_ASSERT(bd->size()
123-
>= (align_up(RESERVED_AREA_SIZE + sizeof(reserved_trailer_t), _prog_size)
124-
+ record_size(master_rec_key, sizeof(master_record_data_t))));
125120
}
126121

127122
TDBStore::~TDBStore()
@@ -1026,6 +1021,11 @@ int TDBStore::init()
10261021

10271022
calc_area_params();
10281023

1024+
/* Minimum space required by Reserved area and master record */
1025+
MBED_ASSERT(_bd->size()
1026+
>= (align_up(RESERVED_AREA_SIZE + sizeof(reserved_trailer_t), _prog_size)
1027+
+ record_size(master_rec_key, sizeof(master_record_data_t))));
1028+
10291029
for (uint8_t area = 0; area < _num_areas; area++) {
10301030
area_state[area] = TDBSTORE_AREA_STATE_NONE;
10311031
versions[area] = 0;

0 commit comments

Comments
 (0)