Skip to content

Commit 9a126e7

Browse files
committed
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
2 parents 38fabca + 69be4ef commit 9a126e7

File tree

3 files changed

+12
-22
lines changed

3 files changed

+12
-22
lines changed

arch/x86/boot/boot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ void query_edd(void);
309309
void __attribute__((noreturn)) die(void);
310310

311311
/* memory.c */
312-
int detect_memory(void);
312+
void detect_memory(void);
313313

314314
/* pm.c */
315315
void __attribute__((noreturn)) go_to_protected_mode(void);

arch/x86/boot/memory.c

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#define SMAP 0x534d4150 /* ASCII "SMAP" */
1919

20-
static int detect_memory_e820(void)
20+
static void detect_memory_e820(void)
2121
{
2222
int count = 0;
2323
struct biosregs ireg, oreg;
@@ -68,10 +68,10 @@ static int detect_memory_e820(void)
6868
count++;
6969
} while (ireg.ebx && count < ARRAY_SIZE(boot_params.e820_table));
7070

71-
return boot_params.e820_entries = count;
71+
boot_params.e820_entries = count;
7272
}
7373

74-
static int detect_memory_e801(void)
74+
static void detect_memory_e801(void)
7575
{
7676
struct biosregs ireg, oreg;
7777

@@ -80,7 +80,7 @@ static int detect_memory_e801(void)
8080
intcall(0x15, &ireg, &oreg);
8181

8282
if (oreg.eflags & X86_EFLAGS_CF)
83-
return -1;
83+
return;
8484

8585
/* Do we really need to do this? */
8686
if (oreg.cx || oreg.dx) {
@@ -89,7 +89,7 @@ static int detect_memory_e801(void)
8989
}
9090

9191
if (oreg.ax > 15*1024) {
92-
return -1; /* Bogus! */
92+
return; /* Bogus! */
9393
} else if (oreg.ax == 15*1024) {
9494
boot_params.alt_mem_k = (oreg.bx << 6) + oreg.ax;
9595
} else {
@@ -102,11 +102,9 @@ static int detect_memory_e801(void)
102102
*/
103103
boot_params.alt_mem_k = oreg.ax;
104104
}
105-
106-
return 0;
107105
}
108106

109-
static int detect_memory_88(void)
107+
static void detect_memory_88(void)
110108
{
111109
struct biosregs ireg, oreg;
112110

@@ -115,22 +113,13 @@ static int detect_memory_88(void)
115113
intcall(0x15, &ireg, &oreg);
116114

117115
boot_params.screen_info.ext_mem_k = oreg.ax;
118-
119-
return -(oreg.eflags & X86_EFLAGS_CF); /* 0 or -1 */
120116
}
121117

122-
int detect_memory(void)
118+
void detect_memory(void)
123119
{
124-
int err = -1;
125-
126-
if (detect_memory_e820() > 0)
127-
err = 0;
128-
129-
if (!detect_memory_e801())
130-
err = 0;
120+
detect_memory_e820();
131121

132-
if (!detect_memory_88())
133-
err = 0;
122+
detect_memory_e801();
134123

135-
return err;
124+
detect_memory_88();
136125
}

arch/x86/boot/tools/build.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ static void die(const char * str, ...)
132132
va_list args;
133133
va_start(args, str);
134134
vfprintf(stderr, str, args);
135+
va_end(args);
135136
fputc('\n', stderr);
136137
exit(1);
137138
}

0 commit comments

Comments
 (0)