From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751919AbdFVH0u (ORCPT ); Thu, 22 Jun 2017 03:26:50 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:33974 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751115AbdFVH0t (ORCPT ); Thu, 22 Jun 2017 03:26:49 -0400 Date: Thu, 22 Jun 2017 09:26:44 +0200 From: Ingo Molnar To: "Paul E. McKenney" Cc: Arnd Bergmann , Thomas Gleixner , Sebastian Andrzej Siewior , Anna-Maria Gleixner , Boris Ostrovsky , linux-kernel@vger.kernel.org Subject: Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Message-ID: <20170622072644.so23jacjhvrox5pd@gmail.com> References: <20170621215741.4028236-1-arnd@arndb.de> <20170621221054.GU3721@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170621221054.GU3721@linux.vnet.ibm.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Paul E. McKenney wrote: > On Wed, Jun 21, 2017 at 11:57:28PM +0200, Arnd Bergmann wrote: > > Without CONFIG_SMP, we get a harmless warning about > > an unused variable: > > > > kernel/cpu.c: In function 'boot_cpu_state_init': > > kernel/cpu.c:1778:6: error: unused variable 'cpu' [-Werror=unused-variable] > > > > This reworks the function to have the declaration inside > > of the #ifdef. > > > > Fixes: faeb334286b7 ("rcu: Migrate callbacks earlier in the CPU-offline timeline") > > Signed-off-by: Arnd Bergmann > > I simply added a __maybe_unused in 6441c656acde ("rcu: Migrate callbacks > earlier in the CPU-offline timeline") in my -rcu tree. However, your > approach does have the advantage of complaining if the code using that > variable is removed. > > So, would you be OK with my folding your approach into my commit with > attribution? Also, note that __maybe_unused can be dangerous: it can hide a build warning where there's a _real_ unused variable bug now or due to future changes, causing a real runtime bug. So I think we should consider it a syntactic construct to avoid. Thanks, Ingo