From 5bab7225cac041c26ecfbc92169d04d55211c4b2 Mon Sep 17 00:00:00 2001 From: Rajiv Mohan Date: Tue, 20 Feb 2024 06:06:09 -0800 Subject: [PATCH] lib: system: MPU flag check fix for xilinx platform Check if valid MPU flag is set or not. Current condition checks if flag is 0 or not, which is not intended use of flags Signed-off-by: Rajiv Mohan --- lib/system/freertos/xlnx/sys.c | 2 +- lib/system/generic/xlnx/sys.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/system/freertos/xlnx/sys.c b/lib/system/freertos/xlnx/sys.c index 6bb1210c..26f44ddd 100644 --- a/lib/system/freertos/xlnx/sys.c +++ b/lib/system/freertos/xlnx/sys.c @@ -96,7 +96,7 @@ void *metal_machine_io_mem_map_versal_net(void *va, metal_phys_addr_t pa, for (cnt = 0; cnt < MAX_POSSIBLE_MPU_REGS; cnt++) { - if (!mpu_config[cnt].flags & XMPU_VALID_REGION) + if (!(mpu_config[cnt].flags & XMPU_VALID_REGION)) continue; base_end_addr = mpu_config[cnt].Size + mpu_config[cnt].BaseAddress; diff --git a/lib/system/generic/xlnx/sys.c b/lib/system/generic/xlnx/sys.c index 1b6271f3..f5d12f4b 100644 --- a/lib/system/generic/xlnx/sys.c +++ b/lib/system/generic/xlnx/sys.c @@ -93,7 +93,7 @@ void *metal_machine_io_mem_map_versal_net(void *va, metal_phys_addr_t pa, for (cnt = 0; cnt < MAX_POSSIBLE_MPU_REGS; cnt++) { - if (!mpu_config[cnt].flags & XMPU_VALID_REGION) + if (!(mpu_config[cnt].flags & XMPU_VALID_REGION)) continue; base_end_addr = mpu_config[cnt].Size + mpu_config[cnt].BaseAddress;