Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwpoison-inject: 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: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: linux-mm@kvack.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+16 -39
+16 -39
mm/hwpoison-inject.c
··· 77 77 78 78 static int pfn_inject_init(void) 79 79 { 80 - struct dentry *dentry; 81 - 82 80 hwpoison_dir = debugfs_create_dir("hwpoison", NULL); 83 - if (hwpoison_dir == NULL) 84 - return -ENOMEM; 85 81 86 82 /* 87 83 * Note that the below poison/unpoison interfaces do not involve 88 84 * hardware status change, hence do not require hardware support. 89 85 * They are mainly for testing hwpoison in software level. 90 86 */ 91 - dentry = debugfs_create_file("corrupt-pfn", 0200, hwpoison_dir, 92 - NULL, &hwpoison_fops); 93 - if (!dentry) 94 - goto fail; 87 + debugfs_create_file("corrupt-pfn", 0200, hwpoison_dir, NULL, 88 + &hwpoison_fops); 95 89 96 - dentry = debugfs_create_file("unpoison-pfn", 0200, hwpoison_dir, 97 - NULL, &unpoison_fops); 98 - if (!dentry) 99 - goto fail; 90 + debugfs_create_file("unpoison-pfn", 0200, hwpoison_dir, NULL, 91 + &unpoison_fops); 100 92 101 - dentry = debugfs_create_u32("corrupt-filter-enable", 0600, 102 - hwpoison_dir, &hwpoison_filter_enable); 103 - if (!dentry) 104 - goto fail; 93 + debugfs_create_u32("corrupt-filter-enable", 0600, hwpoison_dir, 94 + &hwpoison_filter_enable); 105 95 106 - dentry = debugfs_create_u32("corrupt-filter-dev-major", 0600, 107 - hwpoison_dir, &hwpoison_filter_dev_major); 108 - if (!dentry) 109 - goto fail; 96 + debugfs_create_u32("corrupt-filter-dev-major", 0600, hwpoison_dir, 97 + &hwpoison_filter_dev_major); 110 98 111 - dentry = debugfs_create_u32("corrupt-filter-dev-minor", 0600, 112 - hwpoison_dir, &hwpoison_filter_dev_minor); 113 - if (!dentry) 114 - goto fail; 99 + debugfs_create_u32("corrupt-filter-dev-minor", 0600, hwpoison_dir, 100 + &hwpoison_filter_dev_minor); 115 101 116 - dentry = debugfs_create_u64("corrupt-filter-flags-mask", 0600, 117 - hwpoison_dir, &hwpoison_filter_flags_mask); 118 - if (!dentry) 119 - goto fail; 102 + debugfs_create_u64("corrupt-filter-flags-mask", 0600, hwpoison_dir, 103 + &hwpoison_filter_flags_mask); 120 104 121 - dentry = debugfs_create_u64("corrupt-filter-flags-value", 0600, 122 - hwpoison_dir, &hwpoison_filter_flags_value); 123 - if (!dentry) 124 - goto fail; 105 + debugfs_create_u64("corrupt-filter-flags-value", 0600, hwpoison_dir, 106 + &hwpoison_filter_flags_value); 125 107 126 108 #ifdef CONFIG_MEMCG 127 - dentry = debugfs_create_u64("corrupt-filter-memcg", 0600, 128 - hwpoison_dir, &hwpoison_filter_memcg); 129 - if (!dentry) 130 - goto fail; 109 + debugfs_create_u64("corrupt-filter-memcg", 0600, hwpoison_dir, 110 + &hwpoison_filter_memcg); 131 111 #endif 132 112 133 113 return 0; 134 - fail: 135 - pfn_inject_exit(); 136 - return -ENOMEM; 137 114 } 138 115 139 116 module_init(pfn_inject_init);