linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] mips: cleanup debugfs usage
@ 2019-01-22 14:57 Greg Kroah-Hartman
  2019-01-22 14:57 ` [PATCH 1/5] mips: cavium: no need to check return value of debugfs_create functions Greg Kroah-Hartman
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 14:57 UTC (permalink / raw)
  To: Ralf Baechle, Paul Burton, James Hogan, John Crispin
  Cc: linux-kernel, linux-mips, Greg Kroah-Hartman

When calling debugfs code, there is no need to ever check the return
value of the call, as no logic should ever change if a call works
properly or not.  Fix up a bunch of x86-specific code to not care about
the results of debugfs.

Greg Kroah-Hartman (5):
  mips: cavium: no need to check return value of debugfs_create
    functions
  mips: ralink: no need to check return value of debugfs_create
    functions
  mips: mm: no need to check return value of debugfs_create functions
  mips: math-emu: no need to check return value of debugfs_create
    functions
  mips: kernel: no need to check return value of debugfs_create
    functions

 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(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/5] mips: cavium: no need to check return value of debugfs_create functions
  2019-01-22 14:57 [PATCH 0/5] mips: cleanup debugfs usage Greg Kroah-Hartman
@ 2019-01-22 14:57 ` Greg Kroah-Hartman
  2019-01-22 18:48   ` Aaro Koskinen
  2019-01-22 14:57 ` [PATCH 2/5] mips: ralink: " Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 14:57 UTC (permalink / raw)
  To: Ralf Baechle, Paul Burton, James Hogan, John Crispin
  Cc: linux-kernel, linux-mips, Greg Kroah-Hartman

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: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@mips.com>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/mips/cavium-octeon/oct_ilm.c | 31 ++++---------------------------
 1 file changed, 4 insertions(+), 27 deletions(-)

diff --git a/arch/mips/cavium-octeon/oct_ilm.c b/arch/mips/cavium-octeon/oct_ilm.c
index 2d68a39f1443..0b6ec4c17896 100644
--- 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, u64 value)
 
 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(void)
 	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);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/5] mips: ralink: no need to check return value of debugfs_create functions
  2019-01-22 14:57 [PATCH 0/5] mips: cleanup debugfs usage Greg Kroah-Hartman
  2019-01-22 14:57 ` [PATCH 1/5] mips: cavium: no need to check return value of debugfs_create functions Greg Kroah-Hartman
@ 2019-01-22 14:57 ` Greg Kroah-Hartman
  2019-01-22 14:57 ` [PATCH 3/5] mips: mm: " Greg Kroah-Hartman
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 14:57 UTC (permalink / raw)
  To: Ralf Baechle, Paul Burton, James Hogan, John Crispin
  Cc: linux-kernel, linux-mips, Greg Kroah-Hartman

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: John Crispin <john@phrozen.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@mips.com>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/mips/ralink/bootrom.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/mips/ralink/bootrom.c b/arch/mips/ralink/bootrom.c
index e1fa5972a81d..648f5eb2ba68 100644
--- a/arch/mips/ralink/bootrom.c
+++ b/arch/mips/ralink/bootrom.c
@@ -35,13 +35,7 @@ static const struct file_operations bootrom_file_ops = {
 
 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;
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/5] mips: mm: no need to check return value of debugfs_create functions
  2019-01-22 14:57 [PATCH 0/5] mips: cleanup debugfs usage Greg Kroah-Hartman
  2019-01-22 14:57 ` [PATCH 1/5] mips: cavium: no need to check return value of debugfs_create functions Greg Kroah-Hartman
  2019-01-22 14:57 ` [PATCH 2/5] mips: ralink: " Greg Kroah-Hartman
@ 2019-01-22 14:57 ` Greg Kroah-Hartman
  2019-01-22 14:57 ` [PATCH 4/5] mips: math-emu: " Greg Kroah-Hartman
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 14:57 UTC (permalink / raw)
  To: Ralf Baechle, Paul Burton, James Hogan, John Crispin
  Cc: linux-kernel, linux-mips, Greg Kroah-Hartman, Andy Shevchenko

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: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@mips.com>
Cc: James Hogan <jhogan@kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-mips@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/mips/mm/sc-debugfs.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/arch/mips/mm/sc-debugfs.c b/arch/mips/mm/sc-debugfs.c
index 2a116084216f..9507421de335 100644
--- a/arch/mips/mm/sc-debugfs.c
+++ b/arch/mips/mm/sc-debugfs.c
@@ -55,20 +55,11 @@ static const struct file_operations sc_prefetch_fops = {
 
 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);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/5] mips: math-emu: no need to check return value of debugfs_create functions
  2019-01-22 14:57 [PATCH 0/5] mips: cleanup debugfs usage Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2019-01-22 14:57 ` [PATCH 3/5] mips: mm: " Greg Kroah-Hartman
@ 2019-01-22 14:57 ` Greg Kroah-Hartman
  2019-01-22 14:57 ` [PATCH 5/5] mips: kernel: " Greg Kroah-Hartman
  2019-01-23  1:34 ` [PATCH 0/5] mips: cleanup debugfs usage Paul Burton
  5 siblings, 0 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 14:57 UTC (permalink / raw)
  To: Ralf Baechle, Paul Burton, James Hogan, John Crispin
  Cc: linux-kernel, linux-mips, Greg Kroah-Hartman, Yangtao Li

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: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@mips.com>
Cc: James Hogan <jhogan@kernel.org>
Cc: Yangtao Li <tiny.windzz@gmail.com>
Cc: linux-mips@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/mips/math-emu/me-debugfs.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/arch/mips/math-emu/me-debugfs.c b/arch/mips/math-emu/me-debugfs.c
index 58798f527356..387724860fa6 100644
--- 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);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/5] mips: kernel: no need to check return value of debugfs_create functions
  2019-01-22 14:57 [PATCH 0/5] mips: cleanup debugfs usage Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2019-01-22 14:57 ` [PATCH 4/5] mips: math-emu: " Greg Kroah-Hartman
@ 2019-01-22 14:57 ` Greg Kroah-Hartman
  2019-01-23  1:34 ` [PATCH 0/5] mips: cleanup debugfs usage Paul Burton
  5 siblings, 0 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 14:57 UTC (permalink / raw)
  To: Ralf Baechle, Paul Burton, James Hogan, John Crispin
  Cc: linux-kernel, linux-mips, Greg Kroah-Hartman, Yangtao Li,
	Andrew Morton, Mike Rapoport, Mathieu Malaterre, Huacai Chen,
	Marcin Nowakowski, Yasha Cherikovsky

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: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@mips.com>
Cc: James Hogan <jhogan@kernel.org>
Cc: Yangtao Li <tiny.windzz@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Mathieu Malaterre <malat@debian.org>
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Marcin Nowakowski <marcin.nowakowski@mips.com>
Cc: Yasha Cherikovsky <yasha.che3@gmail.com>
Cc: linux-mips@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 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 ++++------------
 5 files changed, 16 insertions(+), 64 deletions(-)

diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c
index c50c89a978f1..b4d210bfcdae 100644
--- 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;
 }
 
diff --git a/arch/mips/kernel/segment.c b/arch/mips/kernel/segment.c
index 2703f218202e..0a9bd7b0983b 100644
--- a/arch/mips/kernel/segment.c
+++ b/arch/mips/kernel/segment.c
@@ -95,18 +95,9 @@ static const struct file_operations segments_fops = {
 
 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;
 }
 
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 8c6c48ed786a..44434e50a355 100644
--- 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);
diff --git a/arch/mips/kernel/spinlock_test.c b/arch/mips/kernel/spinlock_test.c
index eaed550e79a2..ab4e3e1b138d 100644
--- a/arch/mips/kernel/spinlock_test.c
+++ b/arch/mips/kernel/spinlock_test.c
@@ -118,23 +118,10 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_multi, multi_get, NULL, "%llu\n");
 
 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);
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
index 595ca9c85111..0ed20a64b285 100644
--- a/arch/mips/kernel/unaligned.c
+++ b/arch/mips/kernel/unaligned.c
@@ -2374,18 +2374,10 @@ asmlinkage void do_ade(struct pt_regs *regs)
 #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);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/5] mips: cavium: no need to check return value of debugfs_create functions
  2019-01-22 14:57 ` [PATCH 1/5] mips: cavium: no need to check return value of debugfs_create functions Greg Kroah-Hartman
@ 2019-01-22 18:48   ` Aaro Koskinen
  2019-01-22 19:22     ` Paul Burton
  0 siblings, 1 reply; 11+ messages in thread
From: Aaro Koskinen @ 2019-01-22 18:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Ralf Baechle, Paul Burton, James Hogan, John Crispin,
	linux-kernel, linux-mips

Hi,

On Tue, Jan 22, 2019 at 03:57:38PM +0100, Greg Kroah-Hartman wrote:
> -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;

The return needs to be deleted now that the function is void.

A.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/5] mips: cavium: no need to check return value of debugfs_create functions
  2019-01-22 18:48   ` Aaro Koskinen
@ 2019-01-22 19:22     ` Paul Burton
  2019-01-22 19:29       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 11+ messages in thread
From: Paul Burton @ 2019-01-22 19:22 UTC (permalink / raw)
  To: Aaro Koskinen, Greg Kroah-Hartman
  Cc: Ralf Baechle, James Hogan, John Crispin, linux-kernel, linux-mips

Hello,

On Tue, Jan 22, 2019 at 08:48:56PM +0200, Aaro Koskinen wrote:
> On Tue, Jan 22, 2019 at 03:57:38PM +0100, Greg Kroah-Hartman wrote:
> > -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;
> 
> The return needs to be deleted now that the function is void.

Well spotted - I'm happy to fix this up whilst applying the patch.

Thanks,
    Paul

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/5] mips: cavium: no need to check return value of debugfs_create functions
  2019-01-22 19:22     ` Paul Burton
@ 2019-01-22 19:29       ` Greg Kroah-Hartman
  2019-01-22 19:45         ` Paul Burton
  0 siblings, 1 reply; 11+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 19:29 UTC (permalink / raw)
  To: Paul Burton
  Cc: Aaro Koskinen, Ralf Baechle, James Hogan, John Crispin,
	linux-kernel, linux-mips

On Tue, Jan 22, 2019 at 07:22:57PM +0000, Paul Burton wrote:
> Hello,
> 
> On Tue, Jan 22, 2019 at 08:48:56PM +0200, Aaro Koskinen wrote:
> > On Tue, Jan 22, 2019 at 03:57:38PM +0100, Greg Kroah-Hartman wrote:
> > > -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;
> > 
> > The return needs to be deleted now that the function is void.
> 
> Well spotted - I'm happy to fix this up whilst applying the patch.

The fact that 0-day didn't catch this makes me worried, is this
platform/driver not being built there?

Thanks for catching this, sorry for the mistake.

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/5] mips: cavium: no need to check return value of debugfs_create functions
  2019-01-22 19:29       ` Greg Kroah-Hartman
@ 2019-01-22 19:45         ` Paul Burton
  0 siblings, 0 replies; 11+ messages in thread
From: Paul Burton @ 2019-01-22 19:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Fengguang Wu, kbuild
  Cc: Aaro Koskinen, Ralf Baechle, James Hogan, John Crispin,
	linux-kernel, linux-mips

Hi Greg,

On Tue, Jan 22, 2019 at 08:29:16PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Jan 22, 2019 at 07:22:57PM +0000, Paul Burton wrote:
> > On Tue, Jan 22, 2019 at 08:48:56PM +0200, Aaro Koskinen wrote:
> > > On Tue, Jan 22, 2019 at 03:57:38PM +0100, Greg Kroah-Hartman wrote:
> > > > -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;
> > > 
> > > The return needs to be deleted now that the function is void.
> > 
> > Well spotted - I'm happy to fix this up whilst applying the patch.
> 
> The fact that 0-day didn't catch this makes me worried, is this
> platform/driver not being built there?

It looks like this code ought to be built as a module for
cavium_octeon_defconfig:

  $ grep oct_ilm arch/mips/cavium-octeon/Makefile
  obj-$(CONFIG_OCTEON_ILM)              += oct_ilm.o

  $ grep OCTEON_ILM arch/mips/configs/cavium_octeon_defconfig
  CONFIG_OCTEON_ILM=m

Fengguang or others - does 0-day build cavium_octeon_defconfig? If so,
does it build modules?

Thanks,
    Paul

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] mips: cleanup debugfs usage
  2019-01-22 14:57 [PATCH 0/5] mips: cleanup debugfs usage Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2019-01-22 14:57 ` [PATCH 5/5] mips: kernel: " Greg Kroah-Hartman
@ 2019-01-23  1:34 ` Paul Burton
  5 siblings, 0 replies; 11+ messages in thread
From: Paul Burton @ 2019-01-23  1:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Ralf Baechle, Paul Burton, James Hogan, John Crispin,
	linux-kernel, linux-mips, Greg Kroah-Hartman, linux-mips

Hello,

Greg Kroah-Hartman wrote:
> When calling debugfs code, there is no need to ever check the return
> value of the call, as no logic should ever change if a call works
> properly or not.  Fix up a bunch of x86-specific code to not care about
> the results of debugfs.
> 
> Greg Kroah-Hartman (5):
> mips: cavium: no need to check return value of debugfs_create
> functions
> mips: ralink: no need to check return value of debugfs_create
> functions
> mips: mm: no need to check return value of debugfs_create functions
> mips: math-emu: no need to check return value of debugfs_create
> functions
> mips: kernel: no need to check return value of debugfs_create
> functions
> 
> 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(-)

Series applied to mips-next.

Thanks,
    Paul

[ This message was auto-generated; if you believe anything is incorrect
  then please email paul.burton@mips.com to report it. ]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-01-23  1:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-22 14:57 [PATCH 0/5] mips: cleanup debugfs usage Greg Kroah-Hartman
2019-01-22 14:57 ` [PATCH 1/5] mips: cavium: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-01-22 18:48   ` Aaro Koskinen
2019-01-22 19:22     ` Paul Burton
2019-01-22 19:29       ` Greg Kroah-Hartman
2019-01-22 19:45         ` Paul Burton
2019-01-22 14:57 ` [PATCH 2/5] mips: ralink: " Greg Kroah-Hartman
2019-01-22 14:57 ` [PATCH 3/5] mips: mm: " Greg Kroah-Hartman
2019-01-22 14:57 ` [PATCH 4/5] mips: math-emu: " Greg Kroah-Hartman
2019-01-22 14:57 ` [PATCH 5/5] mips: kernel: " Greg Kroah-Hartman
2019-01-23  1:34 ` [PATCH 0/5] mips: cleanup debugfs usage Paul Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).