Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750761AbbFHAR3 (ORCPT ); Sun, 7 Jun 2015 20:17:29 -0400 Received: from mail-ig0-f174.google.com ([209.85.213.174]:34303 "EHLO mail-ig0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750762AbbFHARU (ORCPT ); Sun, 7 Jun 2015 20:17:20 -0400 MIME-Version: 1.0 In-Reply-To: <20150608000007.GA3543@mtj.duckdns.org> References: <1433721270-9182-1-git-send-email-lou_langholtz@me.com> <20150608000007.GA3543@mtj.duckdns.org> Date: Sun, 7 Jun 2015 17:17:20 -0700 X-Google-Sender-Auth: tIcz5NHVR3ene0F30hIJ3-rOdWY Message-ID: Subject: Re: [PATCH] kernel/params.c: make use of unused but set variable From: Linus Torvalds To: Tejun Heo Cc: Louis Langholtz , Linux Kernel Mailing List , trivial@kernel.org, Rusty Russell , Andrew Morton Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2131 Lines: 57 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. I have said this before, and apparently I need to sat this again, and probably I will have to say it in the future. We don't add BUG_ON's for random reasons. The *ONLY* acceptable reason for a BUG_ON() is if the machine is dead anyway because of some major internal corruption. We have too many BUG_ON's. We've had people add BUG_ON's because "this cannot happen", and then it turns out they were wrong, and they just killed the machine. Dammit, there's no reason to add a BUG_ON() here in the first place, and the reason of "but but it's an unused error return": is f*cking retarded. Stop this idiocy. We don't write crap code just to satisfy some random coding standard or shut up a compiler error. At most, it could be a "WARN_ON_ONCE()". Maybe even just silently ignore the error. But BUG_ON()? Hell no. NO NO NO. Quite frankly, if you want to add error handling, then dammit, add it right. And no, BUG_ON() is _never_ proper error handling. BUG_ON() is for things like "uhhuh, somebody is trying to free a page that is already free". That is some serious internal corruption. BUG_ON() is _not_ for "I'm not doing any error handling, so I'll sprinkle random lines of BUG_ON() like fairy dust to make the compiler happen". Really. I'm getting very tired indeed of people adding BUG_ON's like that. Stop it. Linus -- 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/