- if (storage_size > 0 && storage_erase_unit > 0) {
- int log_limit = storage_size - storage_erase_unit;
+ if (storage_size > 0) {
+ int log_limit = storage_size;
+
+ if (storage_erase_unit > 0 && use_flash_for_config())
+ log_limit -= storage_erase_unit;
+