Skip to content

Commit b7ed82c

Browse files
MaochenWang1nashif
authored andcommitted
modules: mbedtls: Fix init hang issue
In device init phase, it will call _mbedtls_init before malloc_prepare as mbedtls has higher priority defined in SYS_INIT.. _mbedtls_init() will call psa_crypto_init() and malloc buffer, but z_malloc_heap is not initialized, which will cause device hang. Should call malloc_prepare() before _mbedtls_init to fix this issue, so decrease the priority of mbedtls to default 40. Signed-off-by: Maochen Wang <[email protected]>
1 parent e309f78 commit b7ed82c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/mbedtls/zephyr_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static int _mbedtls_init(void)
104104
}
105105

106106
#if defined(CONFIG_MBEDTLS_INIT)
107-
SYS_INIT(_mbedtls_init, POST_KERNEL, 0);
107+
SYS_INIT(_mbedtls_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
108108
#endif
109109

110110
/* if CONFIG_MBEDTLS_INIT is not defined then this function

0 commit comments

Comments
 (0)