Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751602AbbFHAAU (ORCPT ); Sun, 7 Jun 2015 20:00:20 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:33976 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751196AbbFHAAN (ORCPT ); Sun, 7 Jun 2015 20:00:13 -0400 Date: Mon, 8 Jun 2015 09:00:07 +0900 From: Tejun Heo To: Louis Langholtz Cc: linux-kernel@vger.kernel.org, trivial@kernel.org, rusty@rustcorp.com.au, akpm@linux-foundation.org Subject: Re: [PATCH] kernel/params.c: make use of unused but set variable Message-ID: <20150608000007.GA3543@mtj.duckdns.org> References: <1433721270-9182-1-git-send-email-lou_langholtz@me.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1433721270-9182-1-git-send-email-lou_langholtz@me.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1337 Lines: 35 On Sun, Jun 07, 2015 at 05:54:30PM -0600, Louis Langholtz wrote: > While Rusty Russell wants the return value of sysfs_create_file > ignored, it's annotated '__must_check'. Tejun Heo made the annotaion > and suggests just using BUG_ON(). Meanwhile the compiler warns that > the 'err' variable is set but unused. This patch uses Tejun's > suggestion. This eliminates the warning, satisfies the required check, > and fails-fast with notice if sysfs_create_file actually ever fails > (something that Rusty says should never happen when this code runs). > > Signed-off-by: Louis Langholtz > --- > > diff --git a/kernel/params.c b/kernel/params.c > index a22d6a7..b04a752 100644 > --- a/kernel/params.c > +++ b/kernel/params.c > @@ -853,6 +853,7 @@ static void __init version_sysfs_builtin(void) > mk = locate_module_kobject(vattr->module_name); > if (mk) { > err = sysfs_create_file(&mk->kobj, &vattr->mattr.attr); > + BUG_ON(err); Maybe BUG_ON(sysfs_create_file(...)); is simpler? Other than that, Acked-by: Tejun Heo Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/