]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
sh: no need to check return value of debugfs_create functions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jan 2019 14:50:30 +0000 (15:50 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 3 Jun 2019 13:39:40 +0000 (15:39 +0200)
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>
arch/sh/kernel/kdebugfs.c
arch/sh/mm/asids-debugfs.c
arch/sh/mm/cache-debugfs.c
arch/sh/mm/pmb.c
arch/sh/mm/tlb-debugfs.c

index 95428e05d21244ef7f88b00c0568b5b3dda0809e..8b505e1556a5f8b3cd3ddd453cbb797b4470e621 100644 (file)
@@ -9,9 +9,6 @@ EXPORT_SYMBOL(arch_debugfs_dir);
 static int __init arch_kdebugfs_init(void)
 {
        arch_debugfs_dir = debugfs_create_dir("sh", NULL);
-       if (!arch_debugfs_dir)
-               return -ENOMEM;
-
        return 0;
 }
 arch_initcall(arch_kdebugfs_init);
index e5539e0f8e3b11b8afffdff5f020732fb150c72d..4c1ca197e9c5f213efce54e66655fae16c00524b 100644 (file)
@@ -63,13 +63,8 @@ static const struct file_operations asids_debugfs_fops = {
 
 static int __init asids_debugfs_init(void)
 {
-       struct dentry *asids_dentry;
-
-       asids_dentry = debugfs_create_file("asids", S_IRUSR, arch_debugfs_dir,
-                                          NULL, &asids_debugfs_fops);
-       if (!asids_dentry)
-               return -ENOMEM;
-
-       return PTR_ERR_OR_ZERO(asids_dentry);
+       debugfs_create_file("asids", S_IRUSR, arch_debugfs_dir, NULL,
+                           &asids_debugfs_fops);
+       return 0;
 }
 device_initcall(asids_debugfs_init);
index 4eb9d43578b4c3ead533bcae6030ec4ead92ce95..17d780794497153cbb6935b2e2e81d1a7575dbf1 100644 (file)
@@ -109,22 +109,10 @@ static const struct file_operations cache_debugfs_fops = {
 
 static int __init cache_debugfs_init(void)
 {
-       struct dentry *dcache_dentry, *icache_dentry;
-
-       dcache_dentry = debugfs_create_file("dcache", S_IRUSR, arch_debugfs_dir,
-                                           (unsigned int *)CACHE_TYPE_DCACHE,
-                                           &cache_debugfs_fops);
-       if (!dcache_dentry)
-               return -ENOMEM;
-
-       icache_dentry = debugfs_create_file("icache", S_IRUSR, arch_debugfs_dir,
-                                           (unsigned int *)CACHE_TYPE_ICACHE,
-                                           &cache_debugfs_fops);
-       if (!icache_dentry) {
-               debugfs_remove(dcache_dentry);
-               return -ENOMEM;
-       }
-
+       debugfs_create_file("dcache", S_IRUSR, arch_debugfs_dir,
+                           (void *)CACHE_TYPE_DCACHE, &cache_debugfs_fops);
+       debugfs_create_file("icache", S_IRUSR, arch_debugfs_dir,
+                           (void *)CACHE_TYPE_ICACHE, &cache_debugfs_fops);
        return 0;
 }
 module_init(cache_debugfs_init);
index a53a040d00543ce3938b1e2dbb850fd629858aa6..b59bad86b31e5bbf2cd15f5835d855e8111b66eb 100644 (file)
@@ -861,13 +861,8 @@ static const struct file_operations pmb_debugfs_fops = {
 
 static int __init pmb_debugfs_init(void)
 {
-       struct dentry *dentry;
-
-       dentry = debugfs_create_file("pmb", S_IFREG | S_IRUGO,
-                                    arch_debugfs_dir, NULL, &pmb_debugfs_fops);
-       if (!dentry)
-               return -ENOMEM;
-
+       debugfs_create_file("pmb", S_IFREG | S_IRUGO, arch_debugfs_dir, NULL,
+                           &pmb_debugfs_fops);
        return 0;
 }
 subsys_initcall(pmb_debugfs_init);
index dea637a09246c2f7136255dff64b00c8558b7155..11c6148283f3c7a05efb616d68b279587ea70d66 100644 (file)
@@ -149,22 +149,10 @@ static const struct file_operations tlb_debugfs_fops = {
 
 static int __init tlb_debugfs_init(void)
 {
-       struct dentry *itlb, *utlb;
-
-       itlb = debugfs_create_file("itlb", S_IRUSR, arch_debugfs_dir,
-                                  (unsigned int *)TLB_TYPE_ITLB,
-                                  &tlb_debugfs_fops);
-       if (unlikely(!itlb))
-               return -ENOMEM;
-
-       utlb = debugfs_create_file("utlb", S_IRUSR, arch_debugfs_dir,
-                                  (unsigned int *)TLB_TYPE_UTLB,
-                                  &tlb_debugfs_fops);
-       if (unlikely(!utlb)) {
-               debugfs_remove(itlb);
-               return -ENOMEM;
-       }
-
+       debugfs_create_file("itlb", S_IRUSR, arch_debugfs_dir,
+                           (void *)TLB_TYPE_ITLB, &tlb_debugfs_fops);
+       debugfs_create_file("utlb", S_IRUSR, arch_debugfs_dir,
+                           (void *)TLB_TYPE_UTLB, &tlb_debugfs_fops);
        return 0;
 }
 module_init(tlb_debugfs_init);