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

From: Borislav Petkov
Date: Wed Jun 12 2019 - 11:52:18 EST


On Wed, Jun 12, 2019 at 05:41:22PM +0200, Greg Kroah-Hartman wrote:
> On Wed, Jun 12, 2019 at 05:18:56PM +0200, Borislav Petkov wrote:
> > On Wed, Jun 12, 2019 at 05:15:31PM +0200, 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: Borislav Petkov <bp@xxxxxxxxx>
> > > Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
> > > Cc: <x86@xxxxxxxxxx>
> > > Cc: Tony Luck <tony.luck@xxxxxxxxx>
> > > Cc: Vishal Verma <vishal.l.verma@xxxxxxxxx>
> > > Cc: Pu Wen <puwen@xxxxxxxx>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> > > ---
> > > arch/x86/kernel/cpu/mce/core.c | 16 +++++---------
> > > arch/x86/kernel/cpu/mce/inject.c | 34 +++++-------------------------
> > > arch/x86/kernel/cpu/mce/severity.c | 14 +++---------
> > > 3 files changed, 13 insertions(+), 51 deletions(-)
> >
> > I think I'm having a deja-vu:
> >
> > https://lkml.kernel.org/r/20190122215326.GM26587@xxxxxxx
>
> Ah, I thought I had sent this out before...
>
> Anyway, I'll fix this up, but really, you will not have a debugfs file
> fail creation unless the system is totally out of memory...

Promise? :-P

I mean, I don't mind getting rid of all that error handling getting in
the way of the code but we'll leave the injector in a half-init state if
the allocation fails.

I guess I can take this and see what breaks. If it does, we can always
revert it...

Btw, is your aim to make debugfs_create_file() return void or you're
just doing some cleanups?

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.