Commit 5dd82ba9 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

x86: mm: 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: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent db0487ab
...@@ -26,8 +26,6 @@ static int ptdump_curknl_show(struct seq_file *m, void *v) ...@@ -26,8 +26,6 @@ static int ptdump_curknl_show(struct seq_file *m, void *v)
DEFINE_SHOW_ATTRIBUTE(ptdump_curknl); DEFINE_SHOW_ATTRIBUTE(ptdump_curknl);
#ifdef CONFIG_PAGE_TABLE_ISOLATION #ifdef CONFIG_PAGE_TABLE_ISOLATION
static struct dentry *pe_curusr;
static int ptdump_curusr_show(struct seq_file *m, void *v) static int ptdump_curusr_show(struct seq_file *m, void *v)
{ {
if (current->mm->pgd) { if (current->mm->pgd) {
...@@ -42,8 +40,6 @@ DEFINE_SHOW_ATTRIBUTE(ptdump_curusr); ...@@ -42,8 +40,6 @@ DEFINE_SHOW_ATTRIBUTE(ptdump_curusr);
#endif #endif
#if defined(CONFIG_EFI) && defined(CONFIG_X86_64) #if defined(CONFIG_EFI) && defined(CONFIG_X86_64)
static struct dentry *pe_efi;
static int ptdump_efi_show(struct seq_file *m, void *v) static int ptdump_efi_show(struct seq_file *m, void *v)
{ {
if (efi_mm.pgd) if (efi_mm.pgd)
...@@ -54,41 +50,24 @@ static int ptdump_efi_show(struct seq_file *m, void *v) ...@@ -54,41 +50,24 @@ static int ptdump_efi_show(struct seq_file *m, void *v)
DEFINE_SHOW_ATTRIBUTE(ptdump_efi); DEFINE_SHOW_ATTRIBUTE(ptdump_efi);
#endif #endif
static struct dentry *dir, *pe_knl, *pe_curknl; static struct dentry *dir;
static int __init pt_dump_debug_init(void) static int __init pt_dump_debug_init(void)
{ {
dir = debugfs_create_dir("page_tables", NULL); dir = debugfs_create_dir("page_tables", NULL);
if (!dir)
return -ENOMEM;
pe_knl = debugfs_create_file("kernel", 0400, dir, NULL,
&ptdump_fops);
if (!pe_knl)
goto err;
pe_curknl = debugfs_create_file("current_kernel", 0400, debugfs_create_file("kernel", 0400, dir, NULL, &ptdump_fops);
dir, NULL, &ptdump_curknl_fops); debugfs_create_file("current_kernel", 0400, dir, NULL,
if (!pe_curknl) &ptdump_curknl_fops);
goto err;
#ifdef CONFIG_PAGE_TABLE_ISOLATION #ifdef CONFIG_PAGE_TABLE_ISOLATION
pe_curusr = debugfs_create_file("current_user", 0400, debugfs_create_file("current_user", 0400, dir, NULL,
dir, NULL, &ptdump_curusr_fops); &ptdump_curusr_fops);
if (!pe_curusr)
goto err;
#endif #endif
#if defined(CONFIG_EFI) && defined(CONFIG_X86_64) #if defined(CONFIG_EFI) && defined(CONFIG_X86_64)
pe_efi = debugfs_create_file("efi", 0400, dir, NULL, &ptdump_efi_fops); debugfs_create_file("efi", 0400, dir, NULL, &ptdump_efi_fops);
if (!pe_efi)
goto err;
#endif #endif
return 0; return 0;
err:
debugfs_remove_recursive(dir);
return -ENOMEM;
} }
static void __exit pt_dump_debug_exit(void) static void __exit pt_dump_debug_exit(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment