]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
iommu/omap: No need to check return value of debugfs_create functions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Jul 2019 14:36:49 +0000 (16:36 +0200)
committerJoerg Roedel <jroedel@suse.de>
Thu, 4 Jul 2019 15:26:18 +0000 (17:26 +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: Joerg Roedel <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/omap-iommu-debug.c

index 4abc0ef522a8ef80445947e19ccd21afda3df6f2..f87a72821bad0822388750c793bae053b5688faa 100644 (file)
@@ -239,17 +239,6 @@ DEBUG_FOPS_RO(regs);
 DEFINE_SHOW_ATTRIBUTE(tlb);
 DEFINE_SHOW_ATTRIBUTE(pagetable);
 
-#define __DEBUG_ADD_FILE(attr, mode)                                   \
-       {                                                               \
-               struct dentry *dent;                                    \
-               dent = debugfs_create_file(#attr, mode, obj->debug_dir, \
-                                          obj, &attr##_fops);          \
-               if (!dent)                                              \
-                       goto err;                                       \
-       }
-
-#define DEBUG_ADD_FILE_RO(name) __DEBUG_ADD_FILE(name, 0400)
-
 void omap_iommu_debugfs_add(struct omap_iommu *obj)
 {
        struct dentry *d;
@@ -257,23 +246,13 @@ void omap_iommu_debugfs_add(struct omap_iommu *obj)
        if (!iommu_debug_root)
                return;
 
-       obj->debug_dir = debugfs_create_dir(obj->name, iommu_debug_root);
-       if (!obj->debug_dir)
-               return;
+       d = debugfs_create_dir(obj->name, iommu_debug_root);
+       obj->debug_dir = d;
 
-       d = debugfs_create_u32("nr_tlb_entries", 0400, obj->debug_dir,
-                              &obj->nr_tlb_entries);
-       if (!d)
-               return;
-
-       DEBUG_ADD_FILE_RO(regs);
-       DEBUG_ADD_FILE_RO(tlb);
-       DEBUG_ADD_FILE_RO(pagetable);
-
-       return;
-
-err:
-       debugfs_remove_recursive(obj->debug_dir);
+       debugfs_create_u32("nr_tlb_entries", 0400, d, &obj->nr_tlb_entries);
+       debugfs_create_file("regs", 0400, d, obj, &regs_fops);
+       debugfs_create_file("tlb", 0400, d, obj, &tlb_fops);
+       debugfs_create_file("pagetable", 0400, d, obj, &pagetable_fops);
 }
 
 void omap_iommu_debugfs_remove(struct omap_iommu *obj)
@@ -287,8 +266,6 @@ void omap_iommu_debugfs_remove(struct omap_iommu *obj)
 void __init omap_iommu_debugfs_init(void)
 {
        iommu_debug_root = debugfs_create_dir("omap_iommu", NULL);
-       if (!iommu_debug_root)
-               pr_err("can't create debugfs dir\n");
 }
 
 void __exit omap_iommu_debugfs_exit(void)