[PATCH linux-next] x86/mtrr: Remove the if statement

From: cgel . zte
Date: Thu Nov 04 2021 - 02:24:15 EST


From: luo penghao <luo.penghao@xxxxxxxxxx>

The "if" here is only for assigning the highest_pfn, but the variable
will not be used later. So this if statement should be deleted.

The clang_analyzer complains as follows:

arch/x86/kernel/cpu/mtrr/cleanup.c:950:4 warning:

Value stored to 'highest_pfn' is never read

Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
Signed-off-by: luo penghao <luo.penghao@xxxxxxxxxx>
---
arch/x86/kernel/cpu/mtrr/cleanup.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c
index b5f4304..2c896b4 100644
--- a/arch/x86/kernel/cpu/mtrr/cleanup.c
+++ b/arch/x86/kernel/cpu/mtrr/cleanup.c
@@ -946,8 +946,6 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
if (mtrr_tom2) {
range[nr_range].start = (1ULL<<(32 - PAGE_SHIFT));
range[nr_range].end = mtrr_tom2 >> PAGE_SHIFT;
- if (highest_pfn < range[nr_range].end)
- highest_pfn = range[nr_range].end;
nr_range++;
}
nr_range = x86_get_mtrr_mem_range(range, nr_range, 0, 0);
--
2.15.2