fix(lib/allocator): clang-tidy dead store error
This patch fixes an error reported by the clang-tidy
clang-analyzer-deadcode.DeadStores check:
lib/allocator/src/memory_alloc.c:397 error: Value stored to 'heap'
during its initialization is never read
The `assert(false)` in the mbedtls_memory_buffer_set_verify function
prevented the rest of the function from running, causing clang-tidy to
report this error. The fix is to remove this line. In addition, a
comment has been added to note that the function is not expected to be
called.
Signed-off-by: Chuyue Luo <Chuyue.Luo@arm.com>
Change-Id: Ic2baf57f4c19701e7ac10cdc8f9c0ba110c8e2c8
diff --git a/lib/allocator/src/memory_alloc.c b/lib/allocator/src/memory_alloc.c
index 8c536e8..6af6cb1 100644
--- a/lib/allocator/src/memory_alloc.c
+++ b/lib/allocator/src/memory_alloc.c
@@ -392,13 +392,11 @@
ctx_per_cpu[cpuid] = NULL;
}
+/* NOTE: This function is not currently expected to be called. */
void mbedtls_memory_buffer_set_verify(int verify)
{
struct buffer_alloc_ctx *heap = get_heap_ctx();
- /* this seems to be dead code */
- assert(false);
-
assert(heap);
heap->verify = verify;
}