arm: dump: no need to check return value of debugfs_create functions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jan 2019 14:41:12 +0000 (15:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 3 Jun 2019 13:49:07 +0000 (15:49 +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: Russell King <linux@armlinux.org.uk>
Cc: Jinbum Park <jinb.park7@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/include/asm/ptdump.h
arch/arm/mm/dump.c
arch/arm/mm/ptdump_debugfs.c

index 3ebf9718288d9946ebf502fe88010c9339ee88d9..0c2d3d0d4cc69594226a97df936cdde1fbc10cd7 100644 (file)
@@ -21,13 +21,10 @@ struct ptdump_info {
 
 void ptdump_walk_pgd(struct seq_file *s, struct ptdump_info *info);
 #ifdef CONFIG_ARM_PTDUMP_DEBUGFS
-int ptdump_debugfs_register(struct ptdump_info *info, const char *name);
+void ptdump_debugfs_register(struct ptdump_info *info, const char *name);
 #else
-static inline int ptdump_debugfs_register(struct ptdump_info *info,
-                                       const char *name)
-{
-       return 0;
-}
+static inline void ptdump_debugfs_register(struct ptdump_info *info,
+                                          const char *name) { }
 #endif /* CONFIG_ARM_PTDUMP_DEBUGFS */
 
 void ptdump_check_wx(void);
index 084779c5c893c2050f5756c5c6c3b1512c5d5fd2..eb385a500ed0911fa74fc0ca80d8f6831c1f07ea 100644 (file)
@@ -450,7 +450,7 @@ void ptdump_check_wx(void)
 static int ptdump_init(void)
 {
        ptdump_initialize();
-       return ptdump_debugfs_register(&kernel_ptdump_info,
-                                       "kernel_page_tables");
+       ptdump_debugfs_register(&kernel_ptdump_info, "kernel_page_tables");
+       return 0;
 }
 __initcall(ptdump_init);
index be8d87be4b9384eb3be44ea171c26a1fc16e2b87..598b636615a29ac5aba506242aa1119418b4d52d 100644 (file)
@@ -24,11 +24,7 @@ static const struct file_operations ptdump_fops = {
        .release        = single_release,
 };
 
-int ptdump_debugfs_register(struct ptdump_info *info, const char *name)
+void ptdump_debugfs_register(struct ptdump_info *info, const char *name)
 {
-       struct dentry *pe;
-
-       pe = debugfs_create_file(name, 0400, NULL, info, &ptdump_fops);
-       return pe ? 0 : -ENOMEM;
-
+       debugfs_create_file(name, 0400, NULL, info, &ptdump_fops);
 }