linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] ARM: cleanup debugfs usage
@ 2019-01-22 14:41 Greg Kroah-Hartman
  2019-01-22 14:41 ` [PATCH 1/4] arm64: dump: no need to check return value of debugfs_create functions Greg Kroah-Hartman
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 14:41 UTC (permalink / raw)
  To: Catalin Marinas, Kevin Hilman, Russell King, Will Deacon
  Cc: linux-kernel, linux-arm-kernel, 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 (4):
  arm64: dump: no need to check return value of debugfs_create functions
  arm: dump: no need to check return value of debugfs_create functions
  arm: omap1: no need to check return value of debugfs_create functions
  arm: omap2: no need to check return value of debugfs_create functions

 arch/arm/include/asm/ptdump.h   |  9 ++---
 arch/arm/mach-omap1/clock.c     | 63 +++++++--------------------------
 arch/arm/mach-omap1/pm.c        |  7 ++--
 arch/arm/mach-omap2/pm-debug.c  | 15 ++++----
 arch/arm/mm/dump.c              |  4 +--
 arch/arm/mm/ptdump_debugfs.c    |  8 ++---
 arch/arm64/include/asm/ptdump.h |  9 ++---
 arch/arm64/mm/dump.c            |  4 +--
 arch/arm64/mm/ptdump_debugfs.c  |  7 ++--
 9 files changed, 34 insertions(+), 92 deletions(-)

-- 
2.20.1


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

* [PATCH 1/4] arm64: dump: no need to check return value of debugfs_create functions
  2019-01-22 14:41 [PATCH 0/4] ARM: cleanup debugfs usage Greg Kroah-Hartman
@ 2019-01-22 14:41 ` Greg Kroah-Hartman
  2019-01-25 18:13   ` Catalin Marinas
  2019-01-30 18:21   ` Will Deacon
  2019-01-22 14:41 ` [PATCH 2/4] arm: " Greg Kroah-Hartman
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 14:41 UTC (permalink / raw)
  To: Catalin Marinas, Kevin Hilman, Russell King, Will Deacon
  Cc: linux-kernel, linux-arm-kernel, Greg Kroah-Hartman, Marc Zyngier,
	Peng Donglin

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: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Peng Donglin <dolinux.peng@gmail.com>
Cc: <linux-arm-kernel@lists.infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm64/include/asm/ptdump.h | 9 +++------
 arch/arm64/mm/dump.c            | 4 ++--
 arch/arm64/mm/ptdump_debugfs.c  | 7 ++-----
 3 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/arch/arm64/include/asm/ptdump.h b/arch/arm64/include/asm/ptdump.h
index 6afd8476c60c..9e948a93d26c 100644
--- a/arch/arm64/include/asm/ptdump.h
+++ b/arch/arm64/include/asm/ptdump.h
@@ -34,13 +34,10 @@ struct ptdump_info {
 
 void ptdump_walk_pgd(struct seq_file *s, struct ptdump_info *info);
 #ifdef CONFIG_ARM64_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
 void ptdump_check_wx(void);
 #endif /* CONFIG_ARM64_PTDUMP_CORE */
diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c
index fcb1f2a6d7c6..08c250350b8a 100644
--- a/arch/arm64/mm/dump.c
+++ b/arch/arm64/mm/dump.c
@@ -407,7 +407,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;
 }
 device_initcall(ptdump_init);
diff --git a/arch/arm64/mm/ptdump_debugfs.c b/arch/arm64/mm/ptdump_debugfs.c
index 24d786fc3a4c..064163f25592 100644
--- a/arch/arm64/mm/ptdump_debugfs.c
+++ b/arch/arm64/mm/ptdump_debugfs.c
@@ -12,10 +12,7 @@ static int ptdump_show(struct seq_file *m, void *v)
 }
 DEFINE_SHOW_ATTRIBUTE(ptdump);
 
-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);
 }
-- 
2.20.1


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

* [PATCH 2/4] arm: dump: no need to check return value of debugfs_create functions
  2019-01-22 14:41 [PATCH 0/4] ARM: cleanup debugfs usage Greg Kroah-Hartman
  2019-01-22 14:41 ` [PATCH 1/4] arm64: dump: no need to check return value of debugfs_create functions Greg Kroah-Hartman
@ 2019-01-22 14:41 ` Greg Kroah-Hartman
  2019-01-22 21:25   ` Kees Cook
  2019-01-23  9:42   ` Laura Abbott
  2019-01-22 14:41 ` [PATCH 3/4] arm: omap1: " Greg Kroah-Hartman
  2019-01-22 14:41 ` [PATCH 4/4] arm: omap2: " Greg Kroah-Hartman
  3 siblings, 2 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 14:41 UTC (permalink / raw)
  To: Catalin Marinas, Kevin Hilman, Russell King, Will Deacon
  Cc: linux-kernel, linux-arm-kernel, Greg Kroah-Hartman, Jinbum Park,
	Kees Cook, Laura Abbott

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: Kees Cook <keescook@chromium.org>
Cc: Laura Abbott <labbott@redhat.com>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm/include/asm/ptdump.h | 9 +++------
 arch/arm/mm/dump.c            | 4 ++--
 arch/arm/mm/ptdump_debugfs.c  | 8 ++------
 3 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/arch/arm/include/asm/ptdump.h b/arch/arm/include/asm/ptdump.h
index 3ebf9718288d..0c2d3d0d4cc6 100644
--- a/arch/arm/include/asm/ptdump.h
+++ b/arch/arm/include/asm/ptdump.h
@@ -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);
diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c
index 084779c5c893..eb385a500ed0 100644
--- a/arch/arm/mm/dump.c
+++ b/arch/arm/mm/dump.c
@@ -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);
diff --git a/arch/arm/mm/ptdump_debugfs.c b/arch/arm/mm/ptdump_debugfs.c
index be8d87be4b93..598b636615a2 100644
--- a/arch/arm/mm/ptdump_debugfs.c
+++ b/arch/arm/mm/ptdump_debugfs.c
@@ -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);
 }
-- 
2.20.1


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

* [PATCH 3/4] arm: omap1: no need to check return value of debugfs_create functions
  2019-01-22 14:41 [PATCH 0/4] ARM: cleanup debugfs usage Greg Kroah-Hartman
  2019-01-22 14:41 ` [PATCH 1/4] arm64: dump: no need to check return value of debugfs_create functions Greg Kroah-Hartman
  2019-01-22 14:41 ` [PATCH 2/4] arm: " Greg Kroah-Hartman
@ 2019-01-22 14:41 ` Greg Kroah-Hartman
  2019-01-22 23:05   ` Tony Lindgren
  2019-01-22 14:41 ` [PATCH 4/4] arm: omap2: " Greg Kroah-Hartman
  3 siblings, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 14:41 UTC (permalink / raw)
  To: Catalin Marinas, Kevin Hilman, Russell King, Will Deacon
  Cc: linux-kernel, linux-arm-kernel, Greg Kroah-Hartman,
	Paul Walmsley, Aaro Koskinen, Tony Lindgren, linux-omap

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: Paul Walmsley <paul@pwsan.com>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Kevin Hilman <khilman@kernel.org>
Cc: linux-omap@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm/mach-omap1/clock.c | 63 +++++++------------------------------
 arch/arm/mach-omap1/pm.c    |  7 ++---
 2 files changed, 14 insertions(+), 56 deletions(-)

diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index c8c6fe88b2d6..3d7ab2bcf46c 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -990,84 +990,45 @@ static int debug_clock_show(struct seq_file *s, void *unused)
 
 DEFINE_SHOW_ATTRIBUTE(debug_clock);
 
-static int clk_debugfs_register_one(struct clk *c)
+static void clk_debugfs_register_one(struct clk *c)
 {
-	int err;
 	struct dentry *d;
 	struct clk *pa = c->parent;
 
 	d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root);
-	if (!d)
-		return -ENOMEM;
 	c->dent = d;
 
-	d = debugfs_create_u8("usecount", S_IRUGO, c->dent, &c->usecount);
-	if (!d) {
-		err = -ENOMEM;
-		goto err_out;
-	}
-	d = debugfs_create_ulong("rate", S_IRUGO, c->dent, &c->rate);
-	if (!d) {
-		err = -ENOMEM;
-		goto err_out;
-	}
-	d = debugfs_create_x8("flags", S_IRUGO, c->dent, &c->flags);
-	if (!d) {
-		err = -ENOMEM;
-		goto err_out;
-	}
-	return 0;
-
-err_out:
-	debugfs_remove_recursive(c->dent);
-	return err;
+	debugfs_create_u8("usecount", S_IRUGO, c->dent, &c->usecount);
+	debugfs_create_ulong("rate", S_IRUGO, c->dent, &c->rate);
+	debugfs_create_x8("flags", S_IRUGO, c->dent, &c->flags);
 }
 
-static int clk_debugfs_register(struct clk *c)
+static void clk_debugfs_register(struct clk *c)
 {
 	int err;
 	struct clk *pa = c->parent;
 
-	if (pa && !pa->dent) {
-		err = clk_debugfs_register(pa);
-		if (err)
-			return err;
-	}
+	if (pa && !pa->dent)
+		clk_debugfs_register(pa);
 
-	if (!c->dent) {
-		err = clk_debugfs_register_one(c);
-		if (err)
-			return err;
-	}
-	return 0;
+	if (!c->dent)
+		clk_debugfs_register_one(c);
 }
 
 static int __init clk_debugfs_init(void)
 {
 	struct clk *c;
 	struct dentry *d;
-	int err;
 
 	d = debugfs_create_dir("clock", NULL);
-	if (!d)
-		return -ENOMEM;
 	clk_debugfs_root = d;
 
-	list_for_each_entry(c, &clocks, node) {
-		err = clk_debugfs_register(c);
-		if (err)
-			goto err_out;
-	}
+	list_for_each_entry(c, &clocks, node)
+		clk_debugfs_register(c);
 
-	d = debugfs_create_file("summary", S_IRUGO,
-		d, NULL, &debug_clock_fops);
-	if (!d)
-		return -ENOMEM;
+	debugfs_create_file("summary", S_IRUGO, d, NULL, &debug_clock_fops);
 
 	return 0;
-err_out:
-	debugfs_remove_recursive(clk_debugfs_root);
-	return err;
 }
 late_initcall(clk_debugfs_init);
 
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 998075d3ef86..d068958d6f8a 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -539,11 +539,8 @@ static void omap_pm_init_debugfs(void)
 	struct dentry *d;
 
 	d = debugfs_create_dir("pm_debug", NULL);
-	if (!d)
-		return;
-
-	(void) debugfs_create_file("omap_pm", S_IWUSR | S_IRUGO,
-					d, NULL, &omap_pm_debug_fops);
+	debugfs_create_file("omap_pm", S_IWUSR | S_IRUGO, d, NULL,
+			    &omap_pm_debug_fops);
 }
 
 #endif /* CONFIG_DEBUG_FS */
-- 
2.20.1


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

* [PATCH 4/4] arm: omap2: no need to check return value of debugfs_create functions
  2019-01-22 14:41 [PATCH 0/4] ARM: cleanup debugfs usage Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2019-01-22 14:41 ` [PATCH 3/4] arm: omap1: " Greg Kroah-Hartman
@ 2019-01-22 14:41 ` Greg Kroah-Hartman
  2019-01-22 23:06   ` Tony Lindgren
  3 siblings, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 14:41 UTC (permalink / raw)
  To: Catalin Marinas, Kevin Hilman, Russell King, Will Deacon
  Cc: linux-kernel, linux-arm-kernel, Greg Kroah-Hartman,
	Tony Lindgren, linux-omap

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: Kevin Hilman <khilman@kernel.org>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: linux-omap@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm/mach-omap2/pm-debug.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 5a8839203958..1f9334a3d611 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -193,9 +193,8 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir)
 		return 0;
 
 	d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir);
-	if (d)
-		(void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d,
-			(void *)pwrdm, &pwrdm_suspend_fops);
+	debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d, pwrdm,
+			    &pwrdm_suspend_fops);
 
 	return 0;
 }
@@ -233,16 +232,14 @@ static int __init pm_dbg_init(void)
 		return 0;
 
 	d = debugfs_create_dir("pm_debug", NULL);
-	if (!d)
-		return -EINVAL;
 
-	(void) debugfs_create_file("count", 0444, d, NULL, &pm_dbg_counters_fops);
-	(void) debugfs_create_file("time", 0444, d, NULL, &pm_dbg_timers_fops);
+	debugfs_create_file("count", 0444, d, NULL, &pm_dbg_counters_fops);
+	debugfs_create_file("time", 0444, d, NULL, &pm_dbg_timers_fops);
 
 	pwrdm_for_each(pwrdms_setup, (void *)d);
 
-	(void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUSR, d,
-				   &enable_off_mode, &pm_dbg_option_fops);
+	debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUSR, d,
+			    &enable_off_mode, &pm_dbg_option_fops);
 	pm_dbg_init_done = 1;
 
 	return 0;
-- 
2.20.1


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

* Re: [PATCH 2/4] arm: dump: no need to check return value of debugfs_create functions
  2019-01-22 14:41 ` [PATCH 2/4] arm: " Greg Kroah-Hartman
@ 2019-01-22 21:25   ` Kees Cook
  2019-01-23  9:42   ` Laura Abbott
  1 sibling, 0 replies; 13+ messages in thread
From: Kees Cook @ 2019-01-22 21:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Catalin Marinas, Kevin Hilman, Russell King, Will Deacon, LKML,
	linux-arm-kernel, Jinbum Park, Laura Abbott

On Wed, Jan 23, 2019 at 3:41 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> 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: Kees Cook <keescook@chromium.org>
> Cc: Laura Abbott <labbott@redhat.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Do you mean that it bubbles up to an initcall, and the return value is
meaningless there? This seems fine to me...

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  arch/arm/include/asm/ptdump.h | 9 +++------
>  arch/arm/mm/dump.c            | 4 ++--
>  arch/arm/mm/ptdump_debugfs.c  | 8 ++------
>  3 files changed, 7 insertions(+), 14 deletions(-)
>
> diff --git a/arch/arm/include/asm/ptdump.h b/arch/arm/include/asm/ptdump.h
> index 3ebf9718288d..0c2d3d0d4cc6 100644
> --- a/arch/arm/include/asm/ptdump.h
> +++ b/arch/arm/include/asm/ptdump.h
> @@ -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);
> diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c
> index 084779c5c893..eb385a500ed0 100644
> --- a/arch/arm/mm/dump.c
> +++ b/arch/arm/mm/dump.c
> @@ -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);
> diff --git a/arch/arm/mm/ptdump_debugfs.c b/arch/arm/mm/ptdump_debugfs.c
> index be8d87be4b93..598b636615a2 100644
> --- a/arch/arm/mm/ptdump_debugfs.c
> +++ b/arch/arm/mm/ptdump_debugfs.c
> @@ -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);
>  }
> --
> 2.20.1
>


-- 
Kees Cook

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

* Re: [PATCH 3/4] arm: omap1: no need to check return value of debugfs_create functions
  2019-01-22 14:41 ` [PATCH 3/4] arm: omap1: " Greg Kroah-Hartman
@ 2019-01-22 23:05   ` Tony Lindgren
  0 siblings, 0 replies; 13+ messages in thread
From: Tony Lindgren @ 2019-01-22 23:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Catalin Marinas, Kevin Hilman, Russell King, Will Deacon,
	linux-kernel, linux-arm-kernel, Paul Walmsley, Aaro Koskinen,
	linux-omap

* Greg Kroah-Hartman <gregkh@linuxfoundation.org> [190122 14:41]:
> 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.

Acked-by: Tony Lindgren <tony@atomide.com>

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

* Re: [PATCH 4/4] arm: omap2: no need to check return value of debugfs_create functions
  2019-01-22 14:41 ` [PATCH 4/4] arm: omap2: " Greg Kroah-Hartman
@ 2019-01-22 23:06   ` Tony Lindgren
  0 siblings, 0 replies; 13+ messages in thread
From: Tony Lindgren @ 2019-01-22 23:06 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Catalin Marinas, Kevin Hilman, Russell King, Will Deacon,
	linux-kernel, linux-arm-kernel, linux-omap

* Greg Kroah-Hartman <gregkh@linuxfoundation.org> [190122 14:41]:
> 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.

Acked-by: Tony Lindgren <tony@atomide.com>

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

* Re: [PATCH 2/4] arm: dump: no need to check return value of debugfs_create functions
  2019-01-22 14:41 ` [PATCH 2/4] arm: " Greg Kroah-Hartman
  2019-01-22 21:25   ` Kees Cook
@ 2019-01-23  9:42   ` Laura Abbott
  1 sibling, 0 replies; 13+ messages in thread
From: Laura Abbott @ 2019-01-23  9:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Catalin Marinas, Kevin Hilman, Russell King,
	Will Deacon
  Cc: linux-kernel, linux-arm-kernel, Jinbum Park, Kees Cook

On 1/22/19 6:41 AM, Greg Kroah-Hartman wrote:
> 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: Kees Cook <keescook@chromium.org>
> Cc: Laura Abbott <labbott@redhat.com>

Acked-by: Laura Abbott <labbott@redhat.com>

> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>   arch/arm/include/asm/ptdump.h | 9 +++------
>   arch/arm/mm/dump.c            | 4 ++--
>   arch/arm/mm/ptdump_debugfs.c  | 8 ++------
>   3 files changed, 7 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/arm/include/asm/ptdump.h b/arch/arm/include/asm/ptdump.h
> index 3ebf9718288d..0c2d3d0d4cc6 100644
> --- a/arch/arm/include/asm/ptdump.h
> +++ b/arch/arm/include/asm/ptdump.h
> @@ -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);
> diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c
> index 084779c5c893..eb385a500ed0 100644
> --- a/arch/arm/mm/dump.c
> +++ b/arch/arm/mm/dump.c
> @@ -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);
> diff --git a/arch/arm/mm/ptdump_debugfs.c b/arch/arm/mm/ptdump_debugfs.c
> index be8d87be4b93..598b636615a2 100644
> --- a/arch/arm/mm/ptdump_debugfs.c
> +++ b/arch/arm/mm/ptdump_debugfs.c
> @@ -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);
>   }
> 


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

* Re: [PATCH 1/4] arm64: dump: no need to check return value of debugfs_create functions
  2019-01-22 14:41 ` [PATCH 1/4] arm64: dump: no need to check return value of debugfs_create functions Greg Kroah-Hartman
@ 2019-01-25 18:13   ` Catalin Marinas
  2019-01-30 18:21   ` Will Deacon
  1 sibling, 0 replies; 13+ messages in thread
From: Catalin Marinas @ 2019-01-25 18:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Kevin Hilman, Russell King, Will Deacon, linux-kernel,
	linux-arm-kernel, Marc Zyngier, Peng Donglin

On Tue, Jan 22, 2019 at 03:41:11PM +0100, Greg Kroah-Hartman wrote:
> 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: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Peng Donglin <dolinux.peng@gmail.com>
> Cc: <linux-arm-kernel@lists.infradead.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [PATCH 1/4] arm64: dump: no need to check return value of debugfs_create functions
  2019-01-22 14:41 ` [PATCH 1/4] arm64: dump: no need to check return value of debugfs_create functions Greg Kroah-Hartman
  2019-01-25 18:13   ` Catalin Marinas
@ 2019-01-30 18:21   ` Will Deacon
  2019-01-30 19:33     ` Greg Kroah-Hartman
  1 sibling, 1 reply; 13+ messages in thread
From: Will Deacon @ 2019-01-30 18:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Catalin Marinas, Kevin Hilman, Russell King, linux-kernel,
	linux-arm-kernel, Marc Zyngier, Peng Donglin

Hi Greg,

On Tue, Jan 22, 2019 at 03:41:11PM +0100, Greg Kroah-Hartman wrote:
> 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: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Peng Donglin <dolinux.peng@gmail.com>
> Cc: <linux-arm-kernel@lists.infradead.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  arch/arm64/include/asm/ptdump.h | 9 +++------
>  arch/arm64/mm/dump.c            | 4 ++--
>  arch/arm64/mm/ptdump_debugfs.c  | 7 ++-----
>  3 files changed, 7 insertions(+), 13 deletions(-)

Are you taking this via your tree, or would you like us to queue it in
arm64?

Will

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

* Re: [PATCH 1/4] arm64: dump: no need to check return value of debugfs_create functions
  2019-01-30 18:21   ` Will Deacon
@ 2019-01-30 19:33     ` Greg Kroah-Hartman
  2019-01-31 13:57       ` Will Deacon
  0 siblings, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-30 19:33 UTC (permalink / raw)
  To: Will Deacon
  Cc: Catalin Marinas, Kevin Hilman, Russell King, linux-kernel,
	linux-arm-kernel, Marc Zyngier, Peng Donglin

On Wed, Jan 30, 2019 at 06:21:02PM +0000, Will Deacon wrote:
> Hi Greg,
> 
> On Tue, Jan 22, 2019 at 03:41:11PM +0100, Greg Kroah-Hartman wrote:
> > 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: Catalin Marinas <catalin.marinas@arm.com>
> > Cc: Will Deacon <will.deacon@arm.com>
> > Cc: Marc Zyngier <marc.zyngier@arm.com>
> > Cc: Peng Donglin <dolinux.peng@gmail.com>
> > Cc: <linux-arm-kernel@lists.infradead.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  arch/arm64/include/asm/ptdump.h | 9 +++------
> >  arch/arm64/mm/dump.c            | 4 ++--
> >  arch/arm64/mm/ptdump_debugfs.c  | 7 ++-----
> >  3 files changed, 7 insertions(+), 13 deletions(-)
> 
> Are you taking this via your tree, or would you like us to queue it in
> arm64?

What ever is easiest for you is fine with me, I can handle it either
way, just let me know.

thanks,

greg k-h

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

* Re: [PATCH 1/4] arm64: dump: no need to check return value of debugfs_create functions
  2019-01-30 19:33     ` Greg Kroah-Hartman
@ 2019-01-31 13:57       ` Will Deacon
  0 siblings, 0 replies; 13+ messages in thread
From: Will Deacon @ 2019-01-31 13:57 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Catalin Marinas, Kevin Hilman, Russell King, linux-kernel,
	linux-arm-kernel, Marc Zyngier, Peng Donglin

On Wed, Jan 30, 2019 at 08:33:48PM +0100, Greg Kroah-Hartman wrote:
> On Wed, Jan 30, 2019 at 06:21:02PM +0000, Will Deacon wrote:
> > Hi Greg,
> > 
> > On Tue, Jan 22, 2019 at 03:41:11PM +0100, Greg Kroah-Hartman wrote:
> > > 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: Catalin Marinas <catalin.marinas@arm.com>
> > > Cc: Will Deacon <will.deacon@arm.com>
> > > Cc: Marc Zyngier <marc.zyngier@arm.com>
> > > Cc: Peng Donglin <dolinux.peng@gmail.com>
> > > Cc: <linux-arm-kernel@lists.infradead.org>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > ---
> > >  arch/arm64/include/asm/ptdump.h | 9 +++------
> > >  arch/arm64/mm/dump.c            | 4 ++--
> > >  arch/arm64/mm/ptdump_debugfs.c  | 7 ++-----
> > >  3 files changed, 7 insertions(+), 13 deletions(-)
> > 
> > Are you taking this via your tree, or would you like us to queue it in
> > arm64?
> 
> What ever is easiest for you is fine with me, I can handle it either
> way, just let me know.

It's easy enough for us to merge the arm64 bits, so we'll pick that up for
5.1.

Cheers,

Will

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

end of thread, other threads:[~2019-01-31 13:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-22 14:41 [PATCH 0/4] ARM: cleanup debugfs usage Greg Kroah-Hartman
2019-01-22 14:41 ` [PATCH 1/4] arm64: dump: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-01-25 18:13   ` Catalin Marinas
2019-01-30 18:21   ` Will Deacon
2019-01-30 19:33     ` Greg Kroah-Hartman
2019-01-31 13:57       ` Will Deacon
2019-01-22 14:41 ` [PATCH 2/4] arm: " Greg Kroah-Hartman
2019-01-22 21:25   ` Kees Cook
2019-01-23  9:42   ` Laura Abbott
2019-01-22 14:41 ` [PATCH 3/4] arm: omap1: " Greg Kroah-Hartman
2019-01-22 23:05   ` Tony Lindgren
2019-01-22 14:41 ` [PATCH 4/4] arm: omap2: " Greg Kroah-Hartman
2019-01-22 23:06   ` Tony Lindgren

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