Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752286AbbFHFqr (ORCPT ); Mon, 8 Jun 2015 01:46:47 -0400 Received: from st11p01im-asmtp002.me.com ([17.172.204.152]:55538 "EHLO st11p01im-asmtp002.me.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751404AbbFHFqj convert rfc822-to-8bit (ORCPT ); Mon, 8 Jun 2015 01:46:39 -0400 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151,1.0.33,0.0.0000 definitions=2015-06-08_05:2015-06-05,2015-06-08,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1412110000 definitions=main-1506080110 Content-type: text/plain; charset=us-ascii MIME-version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: [PATCH] kernel/params.c: make use of unused but set variable From: Louis Langholtz In-reply-to: Date: Sun, 07 Jun 2015 23:46:35 -0600 Cc: Tejun Heo , Linux Kernel Mailing List , trivial@kernel.org, Rusty Russell , Andrew Morton Content-transfer-encoding: 8BIT Message-id: <1FDBC3D2-5147-4D2F-B503-AD9596705A99@me.com> References: <1433721270-9182-1-git-send-email-lou_langholtz@me.com> <20150608000007.GA3543@mtj.duckdns.org> To: Linus Torvalds X-Mailer: Apple Mail (2.1878.6) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1478 Lines: 34 On Jun 7, 2015, at 6:17 PM, Linus Torvalds wrote: > On Sun, Jun 7, 2015 at 5:00 PM, Tejun Heo wrote: >> On Sun, Jun 07, 2015 at 05:54:30PM -0600, Louis Langholtz wrote: >>> @@ -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, > > Hell no. > > Stop with the random BUG_ON() additions. > ... > The *ONLY* acceptable reason for a BUG_ON() is if the machine is dead > anyway because of some major internal corruption. > ... > At most, it could be a "WARN_ON_ONCE()"... > > Linus Agreed. The comments in the bug.h file say this clearly too - to not use BUG_ON "unless there's really no way out". I originally just wanted a light-weight message to be issued on failure so at least there's some notice that something unexpected happened (and to have the must-check value used). I've submitted a second version now as you probably saw (that instead uses WARN_ON_ONCE).-- 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/