aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao Xingtao <yaoxt.fnst@fujitsu.com>2024-07-22 00:07:33 -0400
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-07-23 20:30:36 +0200
commit7b3e371526d372a41a4d7db89b3a70b24d3a6198 (patch)
treeb003903180b7bc61e787c41f298a7887ac35dcc1
parent007643bddcebf9e7fb8460a4e8068c4f80afa17e (diff)
downloadqemu-7b3e371526d372a41a4d7db89b3a70b24d3a6198.zip
qemu-7b3e371526d372a41a4d7db89b3a70b24d3a6198.tar.gz
qemu-7b3e371526d372a41a4d7db89b3a70b24d3a6198.tar.bz2
cxl/mailbox: make range overlap check more readable
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> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240722040742.11513-5-yaoxt.fnst@fujitsu.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-rw-r--r--hw/cxl/cxl-mailbox-utils.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c
index 74eeb6f..507690c 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;
}