From e00e2d55ce35b84289c7900906dcf878466c3286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=A4=A9=E9=BE=99=20=28Armink=29?= Date: Sun, 30 Jul 2023 16:18:44 +0800 Subject: [PATCH] [components][fal] remove some assert. --- components/fal/src/fal_partition.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/components/fal/src/fal_partition.c b/components/fal/src/fal_partition.c index 92ae074303..a26a018a28 100644 --- a/components/fal/src/fal_partition.c +++ b/components/fal/src/fal_partition.c @@ -321,7 +321,8 @@ _exit: */ const struct fal_partition *fal_partition_find(const char *name) { - assert(init_ok); + if (!init_ok) + return NULL; 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) { - assert(init_ok); assert(len); + if (!init_ok) + return NULL; + *len = partition_table_len; 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) { - assert(init_ok); assert(table); + if (!init_ok) + { + log_e("FAL NOT initialized"); + return; + } + check_and_update_part_cache(table, 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) { - 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; }