[PATCH] kexec jump: fix compiling warning on xchg(&kexec_lock, 0) in kernel_kexec()

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Eric W. Biederman <ebiederm@...>, Pavel Machek <pavel@...>, <nigel@...>, Rafael J. Wysocki <rjw@...>, Andrew Morton <akpm@...>, Vivek Goyal <vgoyal@...>, <mingo@...>, Linus Torvalds <torvalds@...>
Cc: <linux-kernel@...>, Kexec Mailing List <kexec@...>
Date: Wednesday, August 13, 2008 - 5:12 am

Fix compiling warning on xchg(&kexec_lock, 0) in kernel_kexec().

Signed-off-by: Huang Ying <ying.huang@intel.com>

---
 kernel/kexec.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1433,6 +1433,7 @@ module_init(crash_save_vmcoreinfo_init)
 int kernel_kexec(void)
 {
 	int error = 0;
+	int locked;
 
 	if (xchg(&kexec_lock, 1))
 		return -EBUSY;
@@ -1498,7 +1499,8 @@ int kernel_kexec(void)
 #endif
 
  Unlock:
-	xchg(&kexec_lock, 0);
+	locked = xchg(&kexec_lock, 0);
+	BUG_ON(!locked);
 
 	return error;
 }


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] kexec jump: fix compiling warning on xchg(&kexec..., Huang Ying, (Wed Aug 13, 5:12 am)
Re: [PATCH] kexec jump: fix compiling warning on xchg(&amp;k..., Eric W. Biederman, (Wed Aug 13, 2:12 pm)