[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/13] aspeed_smc: make range overlap check more readable
From: |
Yao Xingtao |
Subject: |
[PATCH 06/13] aspeed_smc: make range overlap check more readable |
Date: |
Mon, 22 Jul 2024 00:07:35 -0400 |
use ranges_overlap() instead of open-coding the overlap check to improve
the readability of the code.
Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com>
---
hw/ssi/aspeed_smc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
index 49205ab76d38..cdca359e1d88 100644
--- a/hw/ssi/aspeed_smc.c
+++ b/hw/ssi/aspeed_smc.c
@@ -31,6 +31,7 @@
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "qemu/units.h"
+#include "qemu/range.h"
#include "trace.h"
#include "hw/irq.h"
@@ -246,8 +247,7 @@ static bool aspeed_smc_flash_overlap(const AspeedSMCState
*s,
asc->reg_to_segment(s, s->regs[R_SEG_ADDR0 + i], &seg);
- if (new->addr + new->size > seg.addr &&
- new->addr < seg.addr + seg.size) {
+ if (ranges_overlap(new->addr, new->size, seg.addr, seg.size)) {
aspeed_smc_error("new segment CS%d [ 0x%"
HWADDR_PRIx" - 0x%"HWADDR_PRIx" ] overlaps with "
"CS%d [ 0x%"HWADDR_PRIx" - 0x%"HWADDR_PRIx" ]",
--
2.41.0
- [PATCH 00/13] make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 01/13] range: Make ranges_overlap() return bool, Yao Xingtao, 2024/07/22
- [PATCH 02/13] arm/boot: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 04/13] cxl/mailbox: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 13/13] block/qcow2-cluster: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 05/13] display/sm501: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 10/13] block/vhdx: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 06/13] aspeed_smc: make range overlap check more readable,
Yao Xingtao <=
- [PATCH 08/13] sparc/ldst_helper: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 11/13] crypto/block-luks: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 09/13] system/memory_mapping: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 07/13] qtest/fuzz: make range overlap check more readable, Yao Xingtao, 2024/07/22