[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190612164420.GB27064@kroah.com>
Date: Wed, 12 Jun 2019 18:44:20 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Borislav Petkov <bp@...en8.de>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
Tony Luck <tony.luck@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Pu Wen <puwen@...on.cn>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: mce: no need to check return value of
debugfs_create functions
On Wed, Jun 12, 2019 at 05:47:30PM +0200, Borislav Petkov wrote:
> 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@...utronix.de>
> > > > Cc: Ingo Molnar <mingo@...hat.com>
> > > > Cc: Borislav Petkov <bp@...en8.de>
> > > > Cc: "H. Peter Anvin" <hpa@...or.com>
> > > > Cc: <x86@...nel.org>
> > > > Cc: Tony Luck <tony.luck@...el.com>
> > > > Cc: Vishal Verma <vishal.l.verma@...el.com>
> > > > Cc: Pu Wen <puwen@...on.cn>
> > > > Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> > > > ---
> > > > 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@zn.tnic
> >
> > 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
Yes, the only way this can fail is if:
debugfs superblock can not be pinned - something really went wrong with the vfs layer
file is created with same name - the caller's fault
new_inode() fails - happens if memory is exhausted
So yes, I do promise :)
> 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.
That's fine, your system is hosed then.
> I guess I can take this and see what breaks. If it does, we can always
> revert it...
Yup!
> Btw, is your aim to make debugfs_create_file() return void or you're
> just doing some cleanups?
Yes, that is my long-term goal here. I don't think it will be possible
as there are some valid users that only want a single file and then
remove the file later, but I'll deal with that when I'm done sweeping
the tree. I'm already able to start removing the return value for many
of the other debugfs "helper file" creation functions.
thanks,
greg k-h
Powered by blists - more mailing lists