Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751623AbbFDB7O (ORCPT ); Wed, 3 Jun 2015 21:59:14 -0400 Received: from ozlabs.org ([103.22.144.67]:57555 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751003AbbFDB7G (ORCPT ); Wed, 3 Jun 2015 21:59:06 -0400 From: Rusty Russell To: Tejun Heo , Louis Langholtz Cc: Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: kernel/params.c: 'err' variable "set but not used" and perhaps should be? In-Reply-To: <20150603202237.GI20091@mtj.duckdns.org> References: <87vbf628uy.fsf@rustcorp.com.au> <7E8FFE0D-B9F7-4816-8ECF-2AA5980F3890@me.com> <20150603202237.GI20091@mtj.duckdns.org> User-Agent: Notmuch/0.17 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Thu, 04 Jun 2015 11:03:16 +0930 Message-ID: <87eglsuujn.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1325 Lines: 29 Tejun Heo writes: >> > @@ -853,7 +853,8 @@ 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); >> > + if (sysfs_create_file(&mk->kobj, &vattr->mattr.attr)) >> > + doesnt_happen(); >> > kobject_uevent(&mk->kobj, KOBJ_ADD); >> > kobject_put(&mk->kobj); >> > } >> >> Arguably then, the BUG_ON macro seems more appropriate for this situation >> than this suggested doesnt_happen macro or my original offering of a call to >> pr_warning. > > It does happen. If you don't wanna roll back on failure, just wrap it > in WARN_ON() so that there's at least some indication that something > failed there? It'd kinda suck to be missing some interface files w/o > any indication, wouldn't it? Please describe the circumstances under which this function can fail. Thanks, Rusty. -- 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/