Commit 9a126e78 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 boot updates from Ingo Molnar:
 "Two cleanups"

* 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/boot: Add missing va_end() to die()
  x86/boot: Simplify the detect_memory*() control flow
parents 38fabca1 69be4efe
...@@ -309,7 +309,7 @@ void query_edd(void); ...@@ -309,7 +309,7 @@ void query_edd(void);
void __attribute__((noreturn)) die(void); void __attribute__((noreturn)) die(void);
/* memory.c */ /* memory.c */
int detect_memory(void); void detect_memory(void);
/* pm.c */ /* pm.c */
void __attribute__((noreturn)) go_to_protected_mode(void); void __attribute__((noreturn)) go_to_protected_mode(void);
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#define SMAP 0x534d4150 /* ASCII "SMAP" */ #define SMAP 0x534d4150 /* ASCII "SMAP" */
static int detect_memory_e820(void) static void detect_memory_e820(void)
{ {
int count = 0; int count = 0;
struct biosregs ireg, oreg; struct biosregs ireg, oreg;
...@@ -68,10 +68,10 @@ static int detect_memory_e820(void) ...@@ -68,10 +68,10 @@ static int detect_memory_e820(void)
count++; count++;
} while (ireg.ebx && count < ARRAY_SIZE(boot_params.e820_table)); } while (ireg.ebx && count < ARRAY_SIZE(boot_params.e820_table));
return boot_params.e820_entries = count; boot_params.e820_entries = count;
} }
static int detect_memory_e801(void) static void detect_memory_e801(void)
{ {
struct biosregs ireg, oreg; struct biosregs ireg, oreg;
...@@ -80,7 +80,7 @@ static int detect_memory_e801(void) ...@@ -80,7 +80,7 @@ static int detect_memory_e801(void)
intcall(0x15, &ireg, &oreg); intcall(0x15, &ireg, &oreg);
if (oreg.eflags & X86_EFLAGS_CF) if (oreg.eflags & X86_EFLAGS_CF)
return -1; return;
/* Do we really need to do this? */ /* Do we really need to do this? */
if (oreg.cx || oreg.dx) { if (oreg.cx || oreg.dx) {
...@@ -89,7 +89,7 @@ static int detect_memory_e801(void) ...@@ -89,7 +89,7 @@ static int detect_memory_e801(void)
} }
if (oreg.ax > 15*1024) { if (oreg.ax > 15*1024) {
return -1; /* Bogus! */ return; /* Bogus! */
} else if (oreg.ax == 15*1024) { } else if (oreg.ax == 15*1024) {
boot_params.alt_mem_k = (oreg.bx << 6) + oreg.ax; boot_params.alt_mem_k = (oreg.bx << 6) + oreg.ax;
} else { } else {
...@@ -102,11 +102,9 @@ static int detect_memory_e801(void) ...@@ -102,11 +102,9 @@ static int detect_memory_e801(void)
*/ */
boot_params.alt_mem_k = oreg.ax; boot_params.alt_mem_k = oreg.ax;
} }
return 0;
} }
static int detect_memory_88(void) static void detect_memory_88(void)
{ {
struct biosregs ireg, oreg; struct biosregs ireg, oreg;
...@@ -115,22 +113,13 @@ static int detect_memory_88(void) ...@@ -115,22 +113,13 @@ static int detect_memory_88(void)
intcall(0x15, &ireg, &oreg); intcall(0x15, &ireg, &oreg);
boot_params.screen_info.ext_mem_k = oreg.ax; boot_params.screen_info.ext_mem_k = oreg.ax;
return -(oreg.eflags & X86_EFLAGS_CF); /* 0 or -1 */
} }
int detect_memory(void) void detect_memory(void)
{ {
int err = -1; detect_memory_e820();
if (detect_memory_e820() > 0)
err = 0;
if (!detect_memory_e801())
err = 0;
if (!detect_memory_88()) detect_memory_e801();
err = 0;
return err; detect_memory_88();
} }
...@@ -132,6 +132,7 @@ static void die(const char * str, ...) ...@@ -132,6 +132,7 @@ static void die(const char * str, ...)
va_list args; va_list args;
va_start(args, str); va_start(args, str);
vfprintf(stderr, str, args); vfprintf(stderr, str, args);
va_end(args);
fputc('\n', stderr); fputc('\n', stderr);
exit(1); exit(1);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment