Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libcpu/arm/cortex-m33/mpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ rt_bool_t rt_hw_mpu_region_valid(rt_mem_region_t *region)
LOG_E("Region size is too small");
return RT_FALSE;
}
if (region->size & (~(MPU_MIN_REGION_SIZE - 1U)) != region->size)
if ((region->size & (~(MPU_MIN_REGION_SIZE - 1U))) != region->size)
{
LOG_E("Region size is not a multiple of 32 bytes");
return RT_FALSE;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好像check没有通过,但是似乎是因为原先这里写的返回值没有用负值,要求修改成-RT_FALSE这种,需要一并修改吗(๑•̀ㅂ•́)

}
if ((rt_uint32_t)region->start & (MPU_MIN_REGION_SIZE - 1U) != 0U)
if (((rt_uint32_t)region->start & (MPU_MIN_REGION_SIZE - 1U)) != 0U)
{
LOG_E("Region is not aligned by 32 bytes");
return RT_FALSE;
Expand Down
4 changes: 2 additions & 2 deletions libcpu/arm/cortex-m7/mpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ rt_bool_t rt_hw_mpu_region_valid(rt_mem_region_t *region)
LOG_E("Region size is too small");
return RT_FALSE;
}
if (region->size & (region->size - 1U) != 0U)
if ((region->size & (region->size - 1U)) != 0U)
{
LOG_E("Region size is not power of 2");
return RT_FALSE;
}
if ((rt_uint32_t)region->start & (region->size - 1U) != 0U)
if (((rt_uint32_t)region->start & (region->size - 1U)) != 0U)
{
LOG_E("Region is not naturally aligned");
return RT_FALSE;
Expand Down
Loading