Re: [PATCH] futex: no need to check return value of debugfs_create functions

From: Darren Hart
Date: Sat Jan 26 2019 - 15:26:08 EST


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@xxxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Darren Hart <dvhart@xxxxxxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

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

Reviewed-by: Darren Hart (VMware) <dvhart@xxxxxxxxxxxxx>



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