Skip to content

Commit a4803df

Browse files
committed
x86/boot/e820: Clean up __e820__range_add() a bit
- Use 'idx' index variable instead of a weird 'x' - Make the error message E820-specific - Group the code a bit better Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Andy Shevchenko <andy@kernel.org> Cc: Arnd Bergmann <arnd@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Juergen Gross <jgross@suse.com> Cc: "H . Peter Anvin" <hpa@zytor.com> Cc: Kees Cook <keescook@chromium.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Rapoport <rppt@kernel.org> Cc: Paul Menzel <pmenzel@molgen.mpg.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: David Woodhouse <dwmw@amazon.co.uk> Link: https://patch.msgid.link/20250515120549.2820541-15-mingo@kernel.org
1 parent 4a7a13e commit a4803df

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

arch/x86/kernel/e820.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,18 @@ int e820__get_entry_type(u64 start, u64 end)
166166
*/
167167
static void __init __e820__range_add(struct e820_table *table, u64 start, u64 size, enum e820_type type)
168168
{
169-
int x = table->nr_entries;
169+
int idx = table->nr_entries;
170170

171-
if (x >= ARRAY_SIZE(table->entries)) {
172-
pr_err("too many entries; ignoring [mem %#010llx-%#010llx]\n",
173-
start, start + size - 1);
171+
if (idx >= ARRAY_SIZE(table->entries)) {
172+
pr_err("too many E820 table entries; ignoring [mem %#010llx-%#010llx]\n",
173+
start, start + size-1);
174174
return;
175175
}
176176

177-
table->entries[x].addr = start;
178-
table->entries[x].size = size;
179-
table->entries[x].type = type;
177+
table->entries[idx].addr = start;
178+
table->entries[idx].size = size;
179+
table->entries[idx].type = type;
180+
180181
table->nr_entries++;
181182
}
182183

0 commit comments

Comments
 (0)