dev_mem: Fix config judgment

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
wangjianyu3 2024-07-24 20:39:45 +08:00 committed by Xiang Xiao
parent 3c0befbdbd
commit 6013591cb1
1 changed files with 29 additions and 26 deletions

View File

@ -218,7 +218,8 @@ int devmem_register(void)
return -ENOMEM; return -ENOMEM;
} }
#ifdef CONFIG_BOARD_MEMORY_RANGE if (CONFIG_BOARD_MEMORY_RANGE[0] != '\0')
{
len = parse_memory_region(CONFIG_BOARD_MEMORY_RANGE, region, len = parse_memory_region(CONFIG_BOARD_MEMORY_RANGE, region,
DEVMEM_REGION - 1); DEVMEM_REGION - 1);
if (len < 0) if (len < 0)
@ -226,7 +227,9 @@ int devmem_register(void)
kmm_free(region); kmm_free(region);
return len; return len;
} }
#else }
else
{
if (len + (4 - merge) > DEVMEM_REGION) if (len + (4 - merge) > DEVMEM_REGION)
{ {
len = DEVMEM_REGION - (4 - merge); len = DEVMEM_REGION - (4 - merge);
@ -249,7 +252,7 @@ int devmem_register(void)
region[len].start = (uintptr_t)_sbss; region[len].start = (uintptr_t)_sbss;
region[len++].end = (uintptr_t)_ebss; region[len++].end = (uintptr_t)_ebss;
} }
#endif }
/* register the new MEM driver */ /* register the new MEM driver */