diff mbox series

[1/4] arm64: dump: no need to check return value of debugfs_create functions

Message ID 20190122144114.9816-2-gregkh@linuxfoundation.org (mailing list archive)
State New, archived
Headers show
Series ARM: cleanup debugfs usage | expand

Commit Message

Greg KH Jan. 22, 2019, 2:41 p.m. UTC
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(-)

Comments

Catalin Marinas Jan. 25, 2019, 6:13 p.m. UTC | #1
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>
Will Deacon Jan. 30, 2019, 6:21 p.m. UTC | #2
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
Greg KH Jan. 30, 2019, 7:33 p.m. UTC | #3
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
Will Deacon Jan. 31, 2019, 1:57 p.m. UTC | #4
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
diff mbox series

Patch

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);
 }