Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1160195

[PATCH] kernel/params.c: make use of unused but set variable

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Louis Langholtz <lou_langholtz@me.com>
Newsgroups linux.kernel
Subject [PATCH] kernel/params.c: make use of unused but set variable
Date Mon, 08 Jun 2015 03:00:02 +0200
Message-ID <pySNz-6Jc-9@gated-at.bofh.it> (permalink)
References <pySNz-6Jc-7@gated-at.bofh.it>
X-Original-To linux-kernel@vger.kernel.org
X-Greylist delayed 3600 seconds by postgrey-1.27 at vger.kernel.org; Sun, 07 Jun 2015 20:54:42 EDT
X-Proofpoint-Virus-Version vendor=fsecure engine=2.50.10432:5.14.151,1.0.33,0.0.0000 definitions=2015-06-08_01:2015-06-05,2015-06-07,1970-01-01 signatures=0
X-Proofpoint-Spam-Details rule=notspam policy=default score=0 spamscore=0 suspectscore=4 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1412110000 definitions=main-1506070336
X-Mailer git-send-email 1.9.5 (Apple Git-50.3)
In-Reply-To <http://marc.info/?l=linux-kernel&m=143351431301630>
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 28
Organization linux.* mail to news gateway
X-Original-Cc trivial@kernel.org, htejun@gmail.com, rusty@rustcorp.com.au, akpm@linux-foundation.org, Louis Langholtz <lou_langholtz@me.com>
X-Original-Date Sun, 07 Jun 2015 17:54:30 -0600
X-Original-Message-ID <1433721270-9182-1-git-send-email-lou_langholtz@me.com>
X-Original-References <http://marc.info/?l=linux-kernel&m=143351431301630>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1160195

Show key headers only | View raw


While Rusty Russell wants the return value of sysfs_create_file
ignored, it's annotated '__must_check'. Tejun Heo made the annotaion
and suggests just using BUG_ON(). Meanwhile the compiler warns that
the 'err' variable is set but unused. This patch uses Tejun's
suggestion. This eliminates the warning, satisfies the required check,
and fails-fast with notice if sysfs_create_file actually ever fails
(something that Rusty says should never happen when this code runs).

Signed-off-by: Louis Langholtz <lou_langholtz@me.com>
---

diff --git a/kernel/params.c b/kernel/params.c
index a22d6a7..b04a752 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -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);
 			kobject_uevent(&mk->kobj, KOBJ_ADD);
 			kobject_put(&mk->kobj);
 		}
--
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/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] kernel/params.c: make use of unused but set variable Louis Langholtz <lou_langholtz@me.com> - 2015-06-08 03:00 +0200

csiph-web