Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

orangefs: fix build warning from debugfs cleanup patch

Stephen writes:
After merging the driver-core tree, today's linux-next build (x86_64
allmodconfig) produced this warning:

fs/orangefs/orangefs-debugfs.c: In function 'orangefs_debugfs_init':
fs/orangefs/orangefs-debugfs.c:193:1: warning: label 'out' defined but not used [-Wunused-label]
out:
^~~
fs/orangefs/orangefs-debugfs.c: In function 'orangefs_kernel_debug_init':
fs/orangefs/orangefs-debugfs.c:204:17: warning: unused variable 'ret' [-Wunused-variable]
struct dentry *ret;
^~~
Fix this up and change the return type of the function to void as it can
not fail, which cleans up some more code and variables as well.

Cc: Mike Marshall <hubcap@omnibond.com>
Cc: Martin Brandenburg <martin@omnibond.com>
Cc: devel@lists.orangefs.org
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Fixes: f095adba36bb ("orangefs: no need to check return value of debugfs_create functions")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+6 -21
+4 -15
fs/orangefs/orangefs-debugfs.c
··· 64 64 __u64 mask2; 65 65 }; 66 66 67 - static int orangefs_kernel_debug_init(void); 67 + static void orangefs_kernel_debug_init(void); 68 68 69 69 static int orangefs_debug_help_open(struct inode *, struct file *); 70 70 static void *help_start(struct seq_file *, loff_t *); ··· 150 150 * initialize kmod debug operations, create orangefs debugfs dir and 151 151 * ORANGEFS_KMOD_DEBUG_HELP_FILE. 152 152 */ 153 - int orangefs_debugfs_init(int debug_mask) 153 + void orangefs_debugfs_init(int debug_mask) 154 154 { 155 - int rc = -ENOMEM; 156 - 157 155 /* convert input debug mask to a 64-bit unsigned integer */ 158 156 orangefs_gossip_debug_mask = (unsigned long long)debug_mask; 159 157 ··· 186 188 187 189 orangefs_debug_disabled = 0; 188 190 189 - rc = orangefs_kernel_debug_init(); 190 - 191 - out: 192 - 193 - return rc; 191 + orangefs_kernel_debug_init(); 194 192 } 195 193 196 194 /* 197 195 * initialize the kernel-debug file. 198 196 */ 199 - static int orangefs_kernel_debug_init(void) 197 + static void orangefs_kernel_debug_init(void) 200 198 { 201 199 int rc = -ENOMEM; 202 - struct dentry *ret; 203 200 char *k_buffer = NULL; 204 201 205 202 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: start\n", __func__); ··· 214 221 debugfs_create_file(ORANGEFS_KMOD_DEBUG_FILE, 0444, debug_dir, k_buffer, 215 222 &kernel_debug_fops); 216 223 217 - rc = 0; 218 - 219 224 out: 220 - 221 225 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: rc:%d:\n", __func__, rc); 222 - return rc; 223 226 } 224 227 225 228
+1 -1
fs/orangefs/orangefs-debugfs.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 - int orangefs_debugfs_init(int); 2 + void orangefs_debugfs_init(int); 3 3 void orangefs_debugfs_cleanup(void); 4 4 int orangefs_prepare_debugfs_help_string(int); 5 5 int orangefs_debugfs_new_client_mask(void __user *);
+1 -5
fs/orangefs/orangefs-mod.c
··· 129 129 if (ret) 130 130 goto cleanup_key_table; 131 131 132 - ret = orangefs_debugfs_init(module_parm_debug_mask); 133 - if (ret) 134 - goto debugfs_init_failed; 132 + orangefs_debugfs_init(module_parm_debug_mask); 135 133 136 134 ret = orangefs_sysfs_init(); 137 135 if (ret) ··· 159 161 orangefs_dev_cleanup(); 160 162 161 163 sysfs_init_failed: 162 - 163 - debugfs_init_failed: 164 164 orangefs_debugfs_cleanup(); 165 165 166 166 cleanup_key_table: