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


Groups > linux.kernel > #1297179

[PATCH v3 4/6] drivers/staging/lustre: Fix another C compiler whine: set but not used

From Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Newsgroups linux.kernel
Subject [PATCH v3 4/6] drivers/staging/lustre: Fix another C compiler whine: set but not used
Date 2015-12-23 01:40 +0100
Message-ID <qIFDc-2Co-17@gated-at.bofh.it> (permalink)
References <qIFDb-2Co-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


  CC [M]  drivers/staging/lustre/lustre/libcfs/module.o
drivers/staging/lustre/lustre/libcfs/module.c: In function 'lustre_insert_debugfs':
drivers/staging/lustre/lustre/libcfs/module.c:670:17: warning: variable 'entry' set but not used [-Wunused-but-set-variable]
  struct dentry *entry;
                     ^

Just ignore the dentry returned, and add a comment that we *know*
we're not really leaking the dentry because something else will be able
to reap it via recursion.

Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
---
 drivers/staging/lustre/lustre/libcfs/module.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
index 96d9d4651a51..4438dc426b54 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -667,8 +667,6 @@ static const struct file_operations lnet_debugfs_file_operations = {
 void lustre_insert_debugfs(struct ctl_table *table,
 			   const struct lnet_debugfs_symlink_def *symlinks)
 {
-	struct dentry *entry;
-
 	if (lnet_debugfs_root == NULL)
 		lnet_debugfs_root = debugfs_create_dir("lnet", NULL);
 
@@ -676,15 +674,17 @@ void lustre_insert_debugfs(struct ctl_table *table,
 	if (IS_ERR_OR_NULL(lnet_debugfs_root))
 		return;
 
+	/* We don't save the dentry returned in next two calls, because
+	 * we don't call debugfs_remove() but rather remove_recursive()
+	 */
 	for (; table->procname; table++)
-		entry = debugfs_create_file(table->procname, table->mode,
-					    lnet_debugfs_root, table,
-					    &lnet_debugfs_file_operations);
+		debugfs_create_file(table->procname, table->mode,
+				    lnet_debugfs_root, table,
+				    &lnet_debugfs_file_operations);
 
 	for (; symlinks && symlinks->name; symlinks++)
-		entry = debugfs_create_symlink(symlinks->name,
-					       lnet_debugfs_root,
-					       symlinks->target);
+		debugfs_create_symlink(symlinks->name, lnet_debugfs_root,
+				       symlinks->target);
 
 }
 EXPORT_SYMBOL_GPL(lustre_insert_debugfs);
-- 
2.6.3

--
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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/6] Patch series to make lustre safe(r) for W=1 compiles Valdis Kletnieks <Valdis.Kletnieks@vt.edu> - 2015-12-23 01:40 +0100
  [PATCH v3 6/6] drivers/staging/lustre: Nuke another unsigned >= 0 assert Valdis Kletnieks <Valdis.Kletnieks@vt.edu> - 2015-12-23 01:40 +0100
  [PATCH v3 5/6] drivers/staging/lustre: Nuke an unsigned >= 0 assert Valdis Kletnieks <Valdis.Kletnieks@vt.edu> - 2015-12-23 01:40 +0100
  [PATCH v3 2/6] drivers/staging/lustre: Fix set-but-unused whinge. Valdis Kletnieks <Valdis.Kletnieks@vt.edu> - 2015-12-23 01:40 +0100
  [PATCH v3 3/6] drivers/staging/lustre: Clean up another C warnining: set but not used Valdis Kletnieks <Valdis.Kletnieks@vt.edu> - 2015-12-23 01:40 +0100
  [PATCH v3 4/6] drivers/staging/lustre: Fix another C compiler whine: set but not used Valdis Kletnieks <Valdis.Kletnieks@vt.edu> - 2015-12-23 01:40 +0100
  [PATCH v3 1/6] drivers/staging/lustre: Silence warning about 'inline' Valdis Kletnieks <Valdis.Kletnieks@vt.edu> - 2015-12-23 01:40 +0100

csiph-web