[lkml]   [2015]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [PATCH] kernel/params.c: make use of unused but set variable
Linus Torvalds <> writes:
> On Sun, Jun 7, 2015 at 5:00 PM, Tejun Heo <> 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?


Subject: params: suppress unused variable error, warn once just in case code changes.

Reported-by: Louis Langholtz <>
Signed-off-by: Rusty Russell <>

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,12 @@ 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);
+ /*
+ * 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);
kobject_uevent(&mk->kobj, KOBJ_ADD);

 \ /
  Last update: 2015-06-12 04:01    [W:0.126 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site