summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-22 09:50:30 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-03 09:39:40 -0400
commit03eb2a08fccc49f93587666e4e1a14ce00df955a (patch)
tree30bf5b474f452fc6c80834a3c16dd569262559d0
parent2fcc6e202a9d45f1556365ee4f4de973e1c834ec (diff)
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>
-rw-r--r--arch/sh/kernel/kdebugfs.c3
-rw-r--r--arch/sh/mm/asids-debugfs.c11
-rw-r--r--arch/sh/mm/cache-debugfs.c20
-rw-r--r--arch/sh/mm/pmb.c9
-rw-r--r--arch/sh/mm/tlb-debugfs.c20
5 files changed, 13 insertions, 50 deletions
diff --git a/arch/sh/kernel/kdebugfs.c b/arch/sh/kernel/kdebugfs.c
index 95428e05d212..8b505e1556a5 100644
--- a/arch/sh/kernel/kdebugfs.c
+++ b/arch/sh/kernel/kdebugfs.c
@@ -9,9 +9,6 @@ EXPORT_SYMBOL(arch_debugfs_dir);
9static int __init arch_kdebugfs_init(void) 9static int __init arch_kdebugfs_init(void)
10{ 10{
11 arch_debugfs_dir = debugfs_create_dir("sh", NULL); 11 arch_debugfs_dir = debugfs_create_dir("sh", NULL);
12 if (!arch_debugfs_dir)
13 return -ENOMEM;
14
15 return 0; 12 return 0;
16} 13}
17arch_initcall(arch_kdebugfs_init); 14arch_initcall(arch_kdebugfs_init);
diff --git a/arch/sh/mm/asids-debugfs.c b/arch/sh/mm/asids-debugfs.c
index e5539e0f8e3b..4c1ca197e9c5 100644
--- a/arch/sh/mm/asids-debugfs.c
+++ b/arch/sh/mm/asids-debugfs.c
@@ -63,13 +63,8 @@ static const struct file_operations asids_debugfs_fops = {
63 63
64static int __init asids_debugfs_init(void) 64static int __init asids_debugfs_init(void)
65{ 65{
66 struct dentry *asids_dentry; 66 debugfs_create_file("asids", S_IRUSR, arch_debugfs_dir, NULL,
67 67 &asids_debugfs_fops);
68 asids_dentry = debugfs_create_file("asids", S_IRUSR, arch_debugfs_dir, 68 return 0;
69 NULL, &asids_debugfs_fops);
70 if (!asids_dentry)
71 return -ENOMEM;
72
73 return PTR_ERR_OR_ZERO(asids_dentry);
74} 69}
75device_initcall(asids_debugfs_init); 70device_initcall(asids_debugfs_init);
diff --git a/arch/sh/mm/cache-debugfs.c b/arch/sh/mm/cache-debugfs.c
index 4eb9d43578b4..17d780794497 100644
--- a/arch/sh/mm/cache-debugfs.c
+++ b/arch/sh/mm/cache-debugfs.c
@@ -109,22 +109,10 @@ static const struct file_operations cache_debugfs_fops = {
109 109
110static int __init cache_debugfs_init(void) 110static int __init cache_debugfs_init(void)
111{ 111{
112 struct dentry *dcache_dentry, *icache_dentry; 112 debugfs_create_file("dcache", S_IRUSR, arch_debugfs_dir,
113 113 (void *)CACHE_TYPE_DCACHE, &cache_debugfs_fops);
114 dcache_dentry = debugfs_create_file("dcache", S_IRUSR, arch_debugfs_dir, 114 debugfs_create_file("icache", S_IRUSR, arch_debugfs_dir,
115 (unsigned int *)CACHE_TYPE_DCACHE, 115 (void *)CACHE_TYPE_ICACHE, &cache_debugfs_fops);
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
128 return 0; 116 return 0;
129} 117}
130module_init(cache_debugfs_init); 118module_init(cache_debugfs_init);
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c
index a53a040d0054..b59bad86b31e 100644
--- a/arch/sh/mm/pmb.c
+++ b/arch/sh/mm/pmb.c
@@ -861,13 +861,8 @@ static const struct file_operations pmb_debugfs_fops = {
861 861
862static int __init pmb_debugfs_init(void) 862static int __init pmb_debugfs_init(void)
863{ 863{
864 struct dentry *dentry; 864 debugfs_create_file("pmb", S_IFREG | S_IRUGO, arch_debugfs_dir, NULL,
865 865 &pmb_debugfs_fops);
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
871 return 0; 866 return 0;
872} 867}
873subsys_initcall(pmb_debugfs_init); 868subsys_initcall(pmb_debugfs_init);
diff --git a/arch/sh/mm/tlb-debugfs.c b/arch/sh/mm/tlb-debugfs.c
index dea637a09246..11c6148283f3 100644
--- a/arch/sh/mm/tlb-debugfs.c
+++ b/arch/sh/mm/tlb-debugfs.c
@@ -149,22 +149,10 @@ static const struct file_operations tlb_debugfs_fops = {
149 149
150static int __init tlb_debugfs_init(void) 150static int __init tlb_debugfs_init(void)
151{ 151{
152 struct dentry *itlb, *utlb; 152 debugfs_create_file("itlb", S_IRUSR, arch_debugfs_dir,
153 153 (void *)TLB_TYPE_ITLB, &tlb_debugfs_fops);
154 itlb = debugfs_create_file("itlb", S_IRUSR, arch_debugfs_dir, 154 debugfs_create_file("utlb", S_IRUSR, arch_debugfs_dir,
155 (unsigned int *)TLB_TYPE_ITLB, 155 (void *)TLB_TYPE_UTLB, &tlb_debugfs_fops);
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
168 return 0; 156 return 0;
169} 157}
170module_init(tlb_debugfs_init); 158module_init(tlb_debugfs_init);