[PATCH v5 3/4] x86/boot/compressed: Declare immovable_mem index in loop initializer
From: Thorsten Blum
Date: Tue Nov 10 2026 - 07:09:54 EST
The for loop index i in process_mem_region() is unused when either
CONFIG_MEMORY_HOTREMOVE or CONFIG_ACPI is disabled. Declare it in the
for loop initializer to prepare for enabling unused-variable warnings.
Reviewed-by: Jan Stancek <jstancek@xxxxxxxxxx>
Reviewed-by: Nicolas Schier <n.schier@xxxxxxxxx>
Signed-off-by: Thorsten Blum <blum@xxxxxxxxxx>
---
arch/x86/boot/compressed/kaslr.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 290153818d0f..cf9d82436725 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -599,7 +599,6 @@ static bool process_mem_region(struct mem_vector *region,
unsigned long minimum,
unsigned long image_size)
{
- int i;
/*
* If no immovable memory found, or MEMORY_HOTREMOVE disabled,
* use @region directly.
@@ -619,7 +618,7 @@ static bool process_mem_region(struct mem_vector *region,
* If immovable memory found, filter the intersection between
* immovable memory and @region.
*/
- for (i = 0; i < num_immovable_mem; i++) {
+ for (int i = 0; i < num_immovable_mem; i++) {
u64 start, end, entry_end, region_end;
struct mem_vector entry;