From: Rusty Russell <rusty@rustcorp.com.au>
To: Tejun Heo <htejun@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Louis Langholtz <lou_langholtz@me.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
trivial@kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] kernel/params.c: make use of unused but set variable
Date: Mon, 15 Jun 2015 05:19:26 +0930 [thread overview]
Message-ID: <87k2v6f4u1.fsf@rustcorp.com.au> (raw)
In-Reply-To: <20150612014831.GG6336@mtj.duckdns.org>
Tejun Heo <htejun@gmail.com> writes:
> On Fri, Jun 12, 2015 at 10:57:24AM +0930, Rusty Russell wrote:
>> Linus Torvalds <torvalds@linux-foundation.org> writes:
>> > On Sun, Jun 7, 2015 at 5:00 PM, Tejun Heo <htejun@gmail.com> wrote:
>> > At most, it could be a "WARN_ON_ONCE()". Maybe even just silently
>> > ignore the error. But BUG_ON()? Hell no.
>>
>> Yeah, in practice it's already (1) paniced if we ran out of memory, or
>> (2) warned if we somehow tried to create two entries with the same name.
>>
>> So the WARN_ON_ONCE() is a bit... meh. How's this, too snarky?
>
> Sounds pretty passive agressive to me. At least reply to the actual
> argument?
Oh. Perhaps my sense of humour is miscalibrated.
err = sysfs_create_file(&mk->kobj, &vattr->mattr.attr);
+ /*
+ * That should not fail at boot due to OOM, and it'll
+ * already warn if we somehow get two identical names,
+ * but this one line should quiet both gcc and lkml.
+ */
+ WARN_ON_ONCE(err);
Oh well, I'll skip the inline commentry entirely then:
===
Subject: params: suppress unused variable error, warn once just in case code changes.
It shouldn't fail due to OOM (it's boot time), and already warns if we
get two identical names. But you never know what the future holds, and
WARN_ON_ONCE() keeps gcc happy with minimal code.
Reported-by: Louis Langholtz <lou_langholtz@me.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff --git a/kernel/params.c b/kernel/params.c
index 7edf31f2ce96..0b9bbdf830cb 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -884,6 +884,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);
+ WARN_ON_ONCE(err);
kobject_uevent(&mk->kobj, KOBJ_ADD);
kobject_put(&mk->kobj);
}
next prev parent reply other threads:[~2015-06-15 0:31 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <http://marc.info/?l=linux-kernel&m=143351431301630>
2015-06-07 23:54 ` [PATCH] kernel/params.c: make use of unused but set variable Louis Langholtz
2015-06-08 0:00 ` Tejun Heo
2015-06-08 0:17 ` Linus Torvalds
2015-06-08 0:58 ` Tejun Heo
2015-06-08 5:24 ` [PATCH v2] " Louis Langholtz
2015-06-10 17:05 ` [PATCH] " Louis Langholtz
2015-06-11 1:54 ` Tejun Heo
2015-06-12 3:17 ` Louis Langholtz
2015-06-08 5:44 ` [PATCH] checkpatch: Warn on BUG and BUG_ON uses Joe Perches
2015-06-08 5:46 ` [PATCH] kernel/params.c: make use of unused but set variable Louis Langholtz
2015-06-08 7:12 ` [PATCH] debug: Deprecate BUG_ON() use in new code, introduce CRASH_ON() Ingo Molnar
2015-06-08 7:40 ` Alexander Holler
2015-06-08 8:08 ` Richard Weinberger
2015-06-08 8:42 ` Alexander Holler
2015-06-08 9:05 ` Ingo Molnar
2015-06-08 9:11 ` Ingo Molnar
2015-06-08 9:22 ` Alexander Holler
2015-06-08 11:29 ` Ingo Molnar
2015-06-08 9:16 ` Alexander Holler
2015-06-08 11:27 ` Ingo Molnar
2015-06-08 18:07 ` Alexander Holler
2015-06-08 19:35 ` Ingo Molnar
2015-06-09 1:07 ` Alexander Holler
2015-06-08 8:09 ` Ingo Molnar
2015-06-12 1:27 ` [PATCH] kernel/params.c: make use of unused but set variable Rusty Russell
2015-06-12 1:48 ` Tejun Heo
2015-06-14 19:49 ` Rusty Russell [this message]
2015-06-16 19:54 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k2v6f4u1.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=akpm@linux-foundation.org \
--cc=htejun@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lou_langholtz@me.com \
--cc=torvalds@linux-foundation.org \
--cc=trivial@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox