[components][fal] remove some assert.

This commit is contained in:
朱天龙 (Armink) 2023-07-30 16:18:44 +08:00 committed by Meco Man
parent 51100ae4a6
commit e00e2d55ce
1 changed files with 12 additions and 4 deletions

View File

@ -321,7 +321,8 @@ _exit:
*/ */
const struct fal_partition *fal_partition_find(const char *name) const struct fal_partition *fal_partition_find(const char *name)
{ {
assert(init_ok); if (!init_ok)
return NULL;
size_t i; size_t i;
@ -353,9 +354,11 @@ static const struct fal_flash_dev *flash_device_find_by_part(const struct fal_pa
*/ */
const struct fal_partition *fal_get_partition_table(size_t *len) const struct fal_partition *fal_get_partition_table(size_t *len)
{ {
assert(init_ok);
assert(len); assert(len);
if (!init_ok)
return NULL;
*len = partition_table_len; *len = partition_table_len;
return partition_table; return partition_table;
@ -370,9 +373,14 @@ const struct fal_partition *fal_get_partition_table(size_t *len)
*/ */
void fal_set_partition_table_temp(struct fal_partition *table, size_t len) void fal_set_partition_table_temp(struct fal_partition *table, size_t len)
{ {
assert(init_ok);
assert(table); assert(table);
if (!init_ok)
{
log_e("FAL NOT initialized");
return;
}
check_and_update_part_cache(table, len); check_and_update_part_cache(table, len);
partition_table_len = len; partition_table_len = len;
@ -400,7 +408,7 @@ int fal_partition_read(const struct fal_partition *part, uint32_t addr, uint8_t
if (addr + size > part->len) if (addr + size > part->len)
{ {
log_e("Partition read error! Partition address out of bound."); log_e("Partition read error! Partition(%s) address(0x%08x) out of bound(0x%08x).", part->name, addr + size, part->len);
return -1; return -1;
} }