[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 04/13] cxl/mailbox: make range overlap check more readable
From: |
Yao Xingtao |
Subject: |
[PATCH 04/13] cxl/mailbox: make range overlap check more readable |
Date: |
Mon, 22 Jul 2024 00:07:33 -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/cxl/cxl-mailbox-utils.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c
index 74eeb6fde739..507690c0dd16 100644
--- a/hw/cxl/cxl-mailbox-utils.c
+++ b/hw/cxl/cxl-mailbox-utils.c
@@ -1086,8 +1086,8 @@ static CXLRetCode cmd_media_get_poison_list(const struct
cxl_cmd *cmd,
QLIST_FOREACH(ent, poison_list, node) {
/* Check for no overlap */
- if (ent->start >= query_start + query_length ||
- ent->start + ent->length <= query_start) {
+ if (!ranges_overlap(ent->start, ent->length,
+ query_start, query_length)) {
continue;
}
record_count++;
@@ -1100,8 +1100,8 @@ static CXLRetCode cmd_media_get_poison_list(const struct
cxl_cmd *cmd,
uint64_t start, stop;
/* Check for no overlap */
- if (ent->start >= query_start + query_length ||
- ent->start + ent->length <= query_start) {
+ if (!ranges_overlap(ent->start, ent->length,
+ query_start, query_length)) {
continue;
}
--
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 <=
- [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, 2024/07/22
- [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