subsys/testsuite: Don't add empty z_malloc_partition to mem domain
The malloc partition may actually be empty, if so, don't try to add it to the domain as that will generate an error. Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
e1e8179690
commit
34473f6821
1 changed files with 9 additions and 6 deletions
|
@ -538,12 +538,15 @@ void main(void)
|
|||
}
|
||||
#ifdef Z_MALLOC_PARTITION_EXISTS
|
||||
/* Allow access to malloc() memory */
|
||||
ret = k_mem_domain_add_partition(&k_mem_domain_default,
|
||||
&z_malloc_partition);
|
||||
if (ret != 0) {
|
||||
PRINT("ERROR: failed to add z_malloc_partition to mem domain (%d)\n",
|
||||
ret);
|
||||
k_oops();
|
||||
if (z_malloc_partition.size != 0) {
|
||||
ret = k_mem_domain_add_partition(&k_mem_domain_default,
|
||||
&z_malloc_partition);
|
||||
if (ret != 0) {
|
||||
PRINT("ERROR: failed to add z_malloc_partition"
|
||||
" to mem domain (%d)\n",
|
||||
ret);
|
||||
k_oops();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue