All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] futex: no need to check return value of debugfs_create functions
@ 2019-01-22 15:21 Greg Kroah-Hartman
  2019-01-26 20:25 ` Darren Hart
  2019-01-29 19:19 ` [tip:locking/core] futex: No " tip-bot for Greg Kroah-Hartman
  0 siblings, 2 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 15:21 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Thomas Gleixner, Ingo Molnar, Peter Zijlstra,
	Darren Hart

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: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Darren Hart <dvhart@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/futex.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index be3bff2315ff..c2ed57b084a4 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -321,12 +321,8 @@ static int __init fail_futex_debugfs(void)
 	if (IS_ERR(dir))
 		return PTR_ERR(dir);
 
-	if (!debugfs_create_bool("ignore-private", mode, dir,
-				 &fail_futex.ignore_private)) {
-		debugfs_remove_recursive(dir);
-		return -ENOMEM;
-	}
-
+	debugfs_create_bool("ignore-private", mode, dir,
+			    &fail_futex.ignore_private);
 	return 0;
 }
 
-- 
2.20.1


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

* Re: [PATCH] futex: no need to check return value of debugfs_create functions
  2019-01-22 15:21 [PATCH] futex: no need to check return value of debugfs_create functions Greg Kroah-Hartman
@ 2019-01-26 20:25 ` Darren Hart
  2019-01-29 19:19 ` [tip:locking/core] futex: No " tip-bot for Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Darren Hart @ 2019-01-26 20:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Thomas Gleixner, Ingo Molnar, Peter Zijlstra

On Tue, Jan 22, 2019 at 04:21:39PM +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: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Darren Hart <dvhart@infradead.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

As documented, and futexes can't be modules, so no need to check for the dentry.

Reviewed-by: Darren Hart (VMware) <dvhart@infradead.org>



> ---
>  kernel/futex.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/futex.c b/kernel/futex.c
> index be3bff2315ff..c2ed57b084a4 100644
> --- a/kernel/futex.c
> +++ b/kernel/futex.c
> @@ -321,12 +321,8 @@ static int __init fail_futex_debugfs(void)
>  	if (IS_ERR(dir))
>  		return PTR_ERR(dir);
>  
> -	if (!debugfs_create_bool("ignore-private", mode, dir,
> -				 &fail_futex.ignore_private)) {
> -		debugfs_remove_recursive(dir);
> -		return -ENOMEM;
> -	}
> -
> +	debugfs_create_bool("ignore-private", mode, dir,
> +			    &fail_futex.ignore_private);
>  	return 0;
>  }
>  
> -- 
> 2.20.1
> 
> 

-- 
Darren Hart
VMware Open Source Technology Center

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

* [tip:locking/core] futex: No need to check return value of debugfs_create functions
  2019-01-22 15:21 [PATCH] futex: no need to check return value of debugfs_create functions Greg Kroah-Hartman
  2019-01-26 20:25 ` Darren Hart
@ 2019-01-29 19:19 ` tip-bot for Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Greg Kroah-Hartman @ 2019-01-29 19:19 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: peterz, tglx, dvhart, mingo, linux-kernel, gregkh, hpa

Commit-ID:  0365aeba50841e087b3d6a0eca1bddccc5e650c8
Gitweb:     https://git.kernel.org/tip/0365aeba50841e087b3d6a0eca1bddccc5e650c8
Author:     Greg Kroah-Hartman <gregkh@linuxfoundation.org>
AuthorDate: Tue, 22 Jan 2019 16:21:39 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 29 Jan 2019 20:15:48 +0100

futex: 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>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Darren Hart (VMware) <dvhart@infradead.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20190122152151.16139-40-gregkh@linuxfoundation.org

---
 kernel/futex.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index fdd312da0992..69e619baf709 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -321,12 +321,8 @@ static int __init fail_futex_debugfs(void)
 	if (IS_ERR(dir))
 		return PTR_ERR(dir);
 
-	if (!debugfs_create_bool("ignore-private", mode, dir,
-				 &fail_futex.ignore_private)) {
-		debugfs_remove_recursive(dir);
-		return -ENOMEM;
-	}
-
+	debugfs_create_bool("ignore-private", mode, dir,
+			    &fail_futex.ignore_private);
 	return 0;
 }
 

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

end of thread, other threads:[~2019-01-29 19:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-22 15:21 [PATCH] futex: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-01-26 20:25 ` Darren Hart
2019-01-29 19:19 ` [tip:locking/core] futex: No " tip-bot for Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.