[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1FDBC3D2-5147-4D2F-B503-AD9596705A99@me.com>
Date: Sun, 07 Jun 2015 23:46:35 -0600
From: Louis Langholtz <lou_langholtz@...com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Tejun Heo <htejun@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
trivial@...nel.org, Rusty Russell <rusty@...tcorp.com.au>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] kernel/params.c: make use of unused but set variable
On Jun 7, 2015, at 6:17 PM, Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Sun, Jun 7, 2015 at 5:00 PM, Tejun Heo <htejun@...il.com> 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists