From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]) by bombadil.infradead.org with esmtps (Exim 4.68 #1 (Red Hat Linux)) id 1KTCdg-0007BH-0u for kexec@lists.infradead.org; Wed, 13 Aug 2008 09:27:32 +0000 Date: Wed, 13 Aug 2008 02:27:12 -0700 From: Andrew Morton Subject: Re: [PATCH] kexec jump: fix compiling warning on xchg(&kexec_lock, 0) in kernel_kexec() Message-Id: <20080813022712.4bea5fea.akpm@linux-foundation.org> In-Reply-To: <1218618760.24951.137.camel@caritas-dev.intel.com> References: <1218618760.24951.137.camel@caritas-dev.intel.com> Mime-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: kexec-bounces@lists.infradead.org Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: Huang Ying Cc: nigel@nigel.suspend2.net, Torvalds , Kexec Mailing List , linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , "Eric W. Biederman" , Pavel Machek , mingo@elte.hu, Linus, Vivek Goyal On Wed, 13 Aug 2008 17:12:40 +0800 Huang Ying wrote: > Fix compiling warning on xchg(&kexec_lock, 0) in kernel_kexec(). > Would prefer that thi code not use such a peculair idiom. I don't believe that it needs to. I guess that's a separate activity. > > --- > 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; > } > Please always quote the compiler output in the changelog when fixing warnings and build errors. The patch is titled "kexec jump: ..." whereas this is just a plain old kexec fix, which is applicable to mainline. We don't need to create that local. I queued this: Subject: kexec: fix compilation warning on xchg(&kexec_lock, 0) in kernel_kexec() From: Huang Ying kernel/kexec.c: In function 'kernel_kexec': kernel/kexec.c:1506: warning: value computed is not used Signed-off-by: Huang Ying Cc: "Eric W. Biederman" Signed-off-by: Andrew Morton --- kernel/kexec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff -puN kernel/kexec.c~kexec-jump-fix-compiling-warning-on-xchgkexec_lock-0-in-kernel_kexec kernel/kexec.c --- a/kernel/kexec.c~kexec-jump-fix-compiling-warning-on-xchgkexec_lock-0-in-kernel_kexec +++ a/kernel/kexec.c @@ -1503,7 +1503,8 @@ int kernel_kexec(void) } Unlock: - xchg(&kexec_lock, 0); + if (!xchg(&kexec_lock, 0)) + BUG(); return error; } _ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec