aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/kexec.c
diff options
context:
space:
mode:
authorGeoff Levand <geoff@infradead.org>2015-02-17 16:45:53 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-17 17:34:51 -0500
commit518a0c716377e5f2c6d22957a5937ec5f328ead1 (patch)
treecb885aaddb934579ba4f65029b8eb8aae8d94193 /kernel/kexec.c
parent9dc5c05f45ca8101025046cda7f8aca8835204f2 (diff)
kexec: simplify conditional
Simplify the code around one of the conditionals in the kexec_load syscall routine. The original code was confusing with a redundant check on KEXEC_ON_CRASH and comments outside of the conditional block. This change switches the order of the conditional check, and cleans up the comments for the conditional. There is no functional change to the code. Signed-off-by: Geoff Levand <geoff@infradead.org> Acked-by: Vivek Goyal <vgoyal@redhat.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Maximilian Attems <max@stro.at> Cc: Michal Marek <mmarek@suse.cz> Cc: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/kexec.c')
-rw-r--r--kernel/kexec.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/kernel/kexec.c b/kernel/kexec.c
index e9a6be4d1ebb..38c25b1f2fd5 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1284,19 +1284,22 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
1284 if (nr_segments > 0) { 1284 if (nr_segments > 0) {
1285 unsigned long i; 1285 unsigned long i;
1286 1286
1287 /* Loading another kernel to reboot into */ 1287 if (flags & KEXEC_ON_CRASH) {
1288 if ((flags & KEXEC_ON_CRASH) == 0) 1288 /*
1289 result = kimage_alloc_init(&image, entry, nr_segments, 1289 * Loading another kernel to switch to if this one
1290 segments, flags); 1290 * crashes. Free any current crash dump kernel before
1291 /* Loading another kernel to switch to if this one crashes */
1292 else if (flags & KEXEC_ON_CRASH) {
1293 /* Free any current crash dump kernel before
1294 * we corrupt it. 1291 * we corrupt it.
1295 */ 1292 */
1293
1296 kimage_free(xchg(&kexec_crash_image, NULL)); 1294 kimage_free(xchg(&kexec_crash_image, NULL));
1297 result = kimage_alloc_init(&image, entry, nr_segments, 1295 result = kimage_alloc_init(&image, entry, nr_segments,
1298 segments, flags); 1296 segments, flags);
1299 crash_map_reserved_pages(); 1297 crash_map_reserved_pages();
1298 } else {
1299 /* Loading another kernel to reboot into. */
1300
1301 result = kimage_alloc_init(&image, entry, nr_segments,
1302 segments, flags);
1300 } 1303 }
1301 if (result) 1304 if (result)
1302 goto out; 1305 goto out;