[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 4/9] hw/loongarch/virt: Remove unused assignment
From: |
Song Gao |
Subject: |
[PULL 4/9] hw/loongarch/virt: Remove unused assignment |
Date: |
Thu, 11 Jul 2024 15:48:24 +0800 |
From: Bibo Mao <maobibo@loongson.cn>
There is abuse usage about local variable gap. Remove
duplicated assignment and solve Coverity reported error.
Resolves: Coverity CID 1546441
Fixes: 3cc451cbce ("hw/loongarch: Refine fwcfg memory map")
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20240612033637.167787-1-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
---
hw/loongarch/virt.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index 8be2d2ff6a..e592b1b6b7 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -1054,7 +1054,6 @@ static void fw_cfg_add_memory(MachineState *ms)
memmap_add_entry(base, gap, 1);
size -= gap;
base = VIRT_HIGHMEM_BASE;
- gap = ram_size - VIRT_LOWMEM_SIZE;
}
if (size) {
@@ -1067,17 +1066,17 @@ static void fw_cfg_add_memory(MachineState *ms)
}
/* add fw_cfg memory map of other nodes */
- size = ram_size - numa_info[0].node_mem;
- gap = VIRT_LOWMEM_BASE + VIRT_LOWMEM_SIZE;
- if (base < gap && (base + size) > gap) {
+ if (numa_info[0].node_mem < gap && ram_size > gap) {
/*
* memory map for the maining nodes splited into two part
- * lowram: [base, +(gap - base))
- * highram: [VIRT_HIGHMEM_BASE, +(size - (gap - base)))
+ * lowram: [base, +(gap - numa_info[0].node_mem))
+ * highram: [VIRT_HIGHMEM_BASE, +(ram_size - gap))
*/
- memmap_add_entry(base, gap - base, 1);
- size -= gap - base;
+ memmap_add_entry(base, gap - numa_info[0].node_mem, 1);
+ size = ram_size - gap;
base = VIRT_HIGHMEM_BASE;
+ } else {
+ size = ram_size - numa_info[0].node_mem;
}
if (size)
--
2.34.1
- [PULL 0/9] loongarch-to-apply queue, Song Gao, 2024/07/11
- [PULL 7/9] target/loongarch: Remove avail_64 in trans_srai_w() and simplify it, Song Gao, 2024/07/11
- [PULL 5/9] MAINTAINERS: Add myself as a reviewer of LoongArch virt machine, Song Gao, 2024/07/11
- [PULL 4/9] hw/loongarch/virt: Remove unused assignment,
Song Gao <=
- [PULL 9/9] target/loongarch: Fix cpu_reset set wrong CSR_CRMD, Song Gao, 2024/07/11
- [PULL 1/9] hw/loongarch/boot.c: fix out-of-bound reading, Song Gao, 2024/07/11
- [PULL 3/9] hw/loongarch: Modify flash block size to 256K, Song Gao, 2024/07/11
- [PULL 2/9] hw/loongarch: Change the tpm support by default, Song Gao, 2024/07/11
- [PULL 8/9] target/loongarch: Set CSR_PRCFG1 and CSR_PRCFG2 values, Song Gao, 2024/07/11
- [PULL 6/9] target/loongarch/kvm: Add software breakpoint support, Song Gao, 2024/07/11
- Re: [PULL 0/9] loongarch-to-apply queue, Philippe Mathieu-Daudé, 2024/07/11