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

sh: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.

Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: <linux-sh@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+13 -50
-3
arch/sh/kernel/kdebugfs.c
··· 9 9 static int __init arch_kdebugfs_init(void) 10 10 { 11 11 arch_debugfs_dir = debugfs_create_dir("sh", NULL); 12 - if (!arch_debugfs_dir) 13 - return -ENOMEM; 14 - 15 12 return 0; 16 13 } 17 14 arch_initcall(arch_kdebugfs_init);
+3 -8
arch/sh/mm/asids-debugfs.c
··· 63 63 64 64 static int __init asids_debugfs_init(void) 65 65 { 66 - struct dentry *asids_dentry; 67 - 68 - asids_dentry = debugfs_create_file("asids", S_IRUSR, arch_debugfs_dir, 69 - NULL, &asids_debugfs_fops); 70 - if (!asids_dentry) 71 - return -ENOMEM; 72 - 73 - return PTR_ERR_OR_ZERO(asids_dentry); 66 + debugfs_create_file("asids", S_IRUSR, arch_debugfs_dir, NULL, 67 + &asids_debugfs_fops); 68 + return 0; 74 69 } 75 70 device_initcall(asids_debugfs_init);
+4 -16
arch/sh/mm/cache-debugfs.c
··· 109 109 110 110 static int __init cache_debugfs_init(void) 111 111 { 112 - struct dentry *dcache_dentry, *icache_dentry; 113 - 114 - dcache_dentry = debugfs_create_file("dcache", S_IRUSR, arch_debugfs_dir, 115 - (unsigned int *)CACHE_TYPE_DCACHE, 116 - &cache_debugfs_fops); 117 - if (!dcache_dentry) 118 - return -ENOMEM; 119 - 120 - icache_dentry = debugfs_create_file("icache", S_IRUSR, arch_debugfs_dir, 121 - (unsigned int *)CACHE_TYPE_ICACHE, 122 - &cache_debugfs_fops); 123 - if (!icache_dentry) { 124 - debugfs_remove(dcache_dentry); 125 - return -ENOMEM; 126 - } 127 - 112 + debugfs_create_file("dcache", S_IRUSR, arch_debugfs_dir, 113 + (void *)CACHE_TYPE_DCACHE, &cache_debugfs_fops); 114 + debugfs_create_file("icache", S_IRUSR, arch_debugfs_dir, 115 + (void *)CACHE_TYPE_ICACHE, &cache_debugfs_fops); 128 116 return 0; 129 117 } 130 118 module_init(cache_debugfs_init);
+2 -7
arch/sh/mm/pmb.c
··· 861 861 862 862 static int __init pmb_debugfs_init(void) 863 863 { 864 - struct dentry *dentry; 865 - 866 - dentry = debugfs_create_file("pmb", S_IFREG | S_IRUGO, 867 - arch_debugfs_dir, NULL, &pmb_debugfs_fops); 868 - if (!dentry) 869 - return -ENOMEM; 870 - 864 + debugfs_create_file("pmb", S_IFREG | S_IRUGO, arch_debugfs_dir, NULL, 865 + &pmb_debugfs_fops); 871 866 return 0; 872 867 } 873 868 subsys_initcall(pmb_debugfs_init);
+4 -16
arch/sh/mm/tlb-debugfs.c
··· 149 149 150 150 static int __init tlb_debugfs_init(void) 151 151 { 152 - struct dentry *itlb, *utlb; 153 - 154 - itlb = debugfs_create_file("itlb", S_IRUSR, arch_debugfs_dir, 155 - (unsigned int *)TLB_TYPE_ITLB, 156 - &tlb_debugfs_fops); 157 - if (unlikely(!itlb)) 158 - return -ENOMEM; 159 - 160 - utlb = debugfs_create_file("utlb", S_IRUSR, arch_debugfs_dir, 161 - (unsigned int *)TLB_TYPE_UTLB, 162 - &tlb_debugfs_fops); 163 - if (unlikely(!utlb)) { 164 - debugfs_remove(itlb); 165 - return -ENOMEM; 166 - } 167 - 152 + debugfs_create_file("itlb", S_IRUSR, arch_debugfs_dir, 153 + (void *)TLB_TYPE_ITLB, &tlb_debugfs_fops); 154 + debugfs_create_file("utlb", S_IRUSR, arch_debugfs_dir, 155 + (void *)TLB_TYPE_UTLB, &tlb_debugfs_fops); 168 156 return 0; 169 157 } 170 158 module_init(tlb_debugfs_init);