diff options
Diffstat (limited to 'p03')
| -rw-r--r-- | p03 | 300 |
1 files changed, 300 insertions, 0 deletions
diff --git a/p03 b/p03 new file mode 100644 index 00000000000000..269a47e100063e --- /dev/null +++ b/p03 @@ -0,0 +1,300 @@ +From e82f2d8eab210dc7eb0dba2bd8e3c64ad485442b Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Date: Wed, 30 May 2018 16:15:35 +0200 +Subject: [PATCH] mips: 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. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + arch/mips/cavium-octeon/oct_ilm.c | 31 ++++--------------------------- + arch/mips/kernel/mips-r2-to-r6-emul.c | 21 ++++----------------- + arch/mips/kernel/segment.c | 15 +++------------ + arch/mips/kernel/setup.c | 7 +------ + arch/mips/kernel/spinlock_test.c | 21 ++++----------------- + arch/mips/kernel/unaligned.c | 16 ++++------------ + arch/mips/math-emu/me-debugfs.c | 23 ++++------------------- + arch/mips/mm/sc-debugfs.c | 15 +++------------ + arch/mips/ralink/bootrom.c | 8 +------- + 9 files changed, 28 insertions(+), 129 deletions(-) + +--- a/arch/mips/cavium-octeon/oct_ilm.c ++++ b/arch/mips/cavium-octeon/oct_ilm.c +@@ -63,31 +63,12 @@ static int reset_statistics(void *data, + + DEFINE_SIMPLE_ATTRIBUTE(reset_statistics_ops, NULL, reset_statistics, "%llu\n"); + +-static int init_debufs(void) ++static void init_debugfs(void) + { +- struct dentry *show_dentry; + dir = debugfs_create_dir("oct_ilm", 0); +- if (!dir) { +- pr_err("oct_ilm: failed to create debugfs entry oct_ilm\n"); +- return -1; +- } +- +- show_dentry = debugfs_create_file("statistics", 0222, dir, NULL, +- &oct_ilm_ops); +- if (!show_dentry) { +- pr_err("oct_ilm: failed to create debugfs entry oct_ilm/statistics\n"); +- return -1; +- } +- +- show_dentry = debugfs_create_file("reset", 0222, dir, NULL, +- &reset_statistics_ops); +- if (!show_dentry) { +- pr_err("oct_ilm: failed to create debugfs entry oct_ilm/reset\n"); +- return -1; +- } +- ++ debugfs_create_file("statistics", 0222, dir, NULL, &oct_ilm_ops); ++ debugfs_create_file("reset", 0222, dir, NULL, &reset_statistics_ops); + return 0; +- + } + + static void init_latency_info(struct latency_info *li, int startup) +@@ -169,11 +150,7 @@ static __init int oct_ilm_module_init(vo + int rc; + int irq = OCTEON_IRQ_TIMER0 + TIMER_NUM; + +- rc = init_debufs(); +- if (rc) { +- WARN(1, "Could not create debugfs entries"); +- return rc; +- } ++ init_debugfs(); + + rc = request_irq(irq, cvm_oct_ciu_timer_interrupt, IRQF_NO_THREAD, + "oct_ilm", 0); +--- a/arch/mips/kernel/mips-r2-to-r6-emul.c ++++ b/arch/mips/kernel/mips-r2-to-r6-emul.c +@@ -2351,23 +2351,10 @@ DEFINE_SHOW_ATTRIBUTE(mipsr2_clear); + + static int __init mipsr2_init_debugfs(void) + { +- struct dentry *mipsr2_emul; +- +- if (!mips_debugfs_dir) +- return -ENODEV; +- +- mipsr2_emul = debugfs_create_file("r2_emul_stats", S_IRUGO, +- mips_debugfs_dir, NULL, +- &mipsr2_emul_fops); +- if (!mipsr2_emul) +- return -ENOMEM; +- +- mipsr2_emul = debugfs_create_file("r2_emul_stats_clear", S_IRUGO, +- mips_debugfs_dir, NULL, +- &mipsr2_clear_fops); +- if (!mipsr2_emul) +- return -ENOMEM; +- ++ debugfs_create_file("r2_emul_stats", S_IRUGO, mips_debugfs_dir, NULL, ++ &mipsr2_emul_fops); ++ debugfs_create_file("r2_emul_stats_clear", S_IRUGO, mips_debugfs_dir, ++ NULL, &mipsr2_clear_fops); + return 0; + } + +--- a/arch/mips/kernel/segment.c ++++ b/arch/mips/kernel/segment.c +@@ -95,18 +95,9 @@ static const struct file_operations segm + + static int __init segments_info(void) + { +- struct dentry *segments; +- +- if (cpu_has_segments) { +- if (!mips_debugfs_dir) +- return -ENODEV; +- +- segments = debugfs_create_file("segments", S_IRUGO, +- mips_debugfs_dir, NULL, +- &segments_fops); +- if (!segments) +- return -ENOMEM; +- } ++ if (cpu_has_segments) ++ debugfs_create_file("segments", S_IRUGO, mips_debugfs_dir, NULL, ++ &segments_fops); + return 0; + } + +--- a/arch/mips/kernel/setup.c ++++ b/arch/mips/kernel/setup.c +@@ -1010,12 +1010,7 @@ unsigned long fw_passed_dtb; + struct dentry *mips_debugfs_dir; + static int __init debugfs_mips(void) + { +- struct dentry *d; +- +- d = debugfs_create_dir("mips", NULL); +- if (!d) +- return -ENOMEM; +- mips_debugfs_dir = d; ++ mips_debugfs_dir = debugfs_create_dir("mips", NULL); + return 0; + } + arch_initcall(debugfs_mips); +--- a/arch/mips/kernel/spinlock_test.c ++++ b/arch/mips/kernel/spinlock_test.c +@@ -118,23 +118,10 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_multi, mult + + static int __init spinlock_test(void) + { +- struct dentry *d; +- +- if (!mips_debugfs_dir) +- return -ENODEV; +- +- d = debugfs_create_file("spin_single", S_IRUGO, +- mips_debugfs_dir, NULL, +- &fops_ss); +- if (!d) +- return -ENOMEM; +- +- d = debugfs_create_file("spin_multi", S_IRUGO, +- mips_debugfs_dir, NULL, +- &fops_multi); +- if (!d) +- return -ENOMEM; +- ++ debugfs_create_file("spin_single", S_IRUGO, mips_debugfs_dir, NULL, ++ &fops_ss); ++ debugfs_create_file("spin_multi", S_IRUGO, mips_debugfs_dir, NULL, ++ &fops_multi); + return 0; + } + device_initcall(spinlock_test); +--- a/arch/mips/kernel/unaligned.c ++++ b/arch/mips/kernel/unaligned.c +@@ -2374,18 +2374,10 @@ sigbus: + #ifdef CONFIG_DEBUG_FS + static int __init debugfs_unaligned(void) + { +- struct dentry *d; +- +- if (!mips_debugfs_dir) +- return -ENODEV; +- d = debugfs_create_u32("unaligned_instructions", S_IRUGO, +- mips_debugfs_dir, &unaligned_instructions); +- if (!d) +- return -ENOMEM; +- d = debugfs_create_u32("unaligned_action", S_IRUGO | S_IWUSR, +- mips_debugfs_dir, &unaligned_action); +- if (!d) +- return -ENOMEM; ++ debugfs_create_u32("unaligned_instructions", S_IRUGO, mips_debugfs_dir, ++ &unaligned_instructions); ++ debugfs_create_u32("unaligned_action", S_IRUGO | S_IWUSR, ++ mips_debugfs_dir, &unaligned_action); + return 0; + } + arch_initcall(debugfs_unaligned); +--- a/arch/mips/math-emu/me-debugfs.c ++++ b/arch/mips/math-emu/me-debugfs.c +@@ -189,32 +189,21 @@ static int __init debugfs_fpuemu(void) + { + struct dentry *fpuemu_debugfs_base_dir; + struct dentry *fpuemu_debugfs_inst_dir; +- struct dentry *d, *reset_file; +- +- if (!mips_debugfs_dir) +- return -ENODEV; + + fpuemu_debugfs_base_dir = debugfs_create_dir("fpuemustats", + mips_debugfs_dir); +- if (!fpuemu_debugfs_base_dir) +- return -ENOMEM; + +- reset_file = debugfs_create_file("fpuemustats_clear", 0444, +- mips_debugfs_dir, NULL, +- &fpuemustats_clear_fops); +- if (!reset_file) +- return -ENOMEM; ++ debugfs_create_file("fpuemustats_clear", 0444, mips_debugfs_dir, NULL, ++ &fpuemustats_clear_fops); + + #define FPU_EMU_STAT_OFFSET(m) \ + offsetof(struct mips_fpu_emulator_stats, m) + + #define FPU_STAT_CREATE(m) \ + do { \ +- d = debugfs_create_file(#m, 0444, fpuemu_debugfs_base_dir, \ ++ debugfs_create_file(#m, 0444, fpuemu_debugfs_base_dir, \ + (void *)FPU_EMU_STAT_OFFSET(m), \ + &fops_fpuemu_stat); \ +- if (!d) \ +- return -ENOMEM; \ + } while (0) + + FPU_STAT_CREATE(emulated); +@@ -233,8 +222,6 @@ do { \ + + fpuemu_debugfs_inst_dir = debugfs_create_dir("instructions", + fpuemu_debugfs_base_dir); +- if (!fpuemu_debugfs_inst_dir) +- return -ENOMEM; + + #define FPU_STAT_CREATE_EX(m) \ + do { \ +@@ -242,11 +229,9 @@ do { \ + \ + adjust_instruction_counter_name(name, #m); \ + \ +- d = debugfs_create_file(name, 0444, fpuemu_debugfs_inst_dir, \ ++ debugfs_create_file(name, 0444, fpuemu_debugfs_inst_dir, \ + (void *)FPU_EMU_STAT_OFFSET(m), \ + &fops_fpuemu_stat); \ +- if (!d) \ +- return -ENOMEM; \ + } while (0) + + FPU_STAT_CREATE_EX(abs_s); +--- a/arch/mips/mm/sc-debugfs.c ++++ b/arch/mips/mm/sc-debugfs.c +@@ -55,20 +55,11 @@ static const struct file_operations sc_p + + static int __init sc_debugfs_init(void) + { +- struct dentry *dir, *file; +- +- if (!mips_debugfs_dir) +- return -ENODEV; ++ struct dentry *dir; + + dir = debugfs_create_dir("l2cache", mips_debugfs_dir); +- if (IS_ERR(dir)) +- return PTR_ERR(dir); +- +- file = debugfs_create_file("prefetch", S_IRUGO | S_IWUSR, dir, +- NULL, &sc_prefetch_fops); +- if (!file) +- return -ENOMEM; +- ++ debugfs_create_file("prefetch", S_IRUGO | S_IWUSR, dir, NULL, ++ &sc_prefetch_fops); + return 0; + } + late_initcall(sc_debugfs_init); +--- a/arch/mips/ralink/bootrom.c ++++ b/arch/mips/ralink/bootrom.c +@@ -35,13 +35,7 @@ static const struct file_operations boot + + static int bootrom_setup(void) + { +- if (!debugfs_create_file("bootrom", 0444, +- NULL, NULL, &bootrom_file_ops)) { +- pr_err("Failed to create bootrom debugfs file\n"); +- +- return -EINVAL; +- } +- ++ debugfs_create_file("bootrom", 0444, NULL, NULL, &bootrom_file_ops); + return 0; + } + |
