From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Kevin Hilman <khilman@kernel.org>,
Len Brown <len.brown@intel.com>,
Linux PM <linux-pm@vger.kernel.org>
Subject: Re: [PATCH] power: domain: no need to check return value of debugfs_create functions
Date: Wed, 23 Jan 2019 11:33:21 +0100 [thread overview]
Message-ID: <20190123103321.GA17640@kroah.com> (raw)
In-Reply-To: <CAPDyKFpZCTG-f+ejqL6v98JCfEU6zmXpVOv+cnBgM6RkHr-Etw@mail.gmail.com>
On Wed, Jan 23, 2019 at 09:20:05AM +0100, Ulf Hansson wrote:
> On Wed, 23 Jan 2019 at 08:59, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > On Wed, Jan 23, 2019 at 08:44:36AM +0100, Ulf Hansson wrote:
> > > On Tue, 22 Jan 2019 at 16:23, Greg Kroah-Hartman
> > > <gregkh@linuxfoundation.org> 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.
> > >
> > > Doesn't this boils done to whether we want to care to check if memory
> > > allocation failed?
> >
> > You should not care.
>
> Okay.
>
> >
> > > Somewhere down the call chain from debugfs_create_dir(), we end up in
> > > alloc_inode() and it looks like that can fail, no?
> >
> > Yes it can, right now it will return NULL, I'll go change that to return
> > ENOMEM, but even then, your really do not care what happens as none of
> > your other code flow should ever care about what debugfs does, or does
> > not, do.
>
> In that case, why don't we convert the debugfs_create_dir() and
> friends, to becomes "void" functions? Or maybe that's your plan going
> forward?
I can't, as sometimes you actually care about using the return value in
another debugfs call.
thanks,
greg k-h
next prev parent reply other threads:[~2019-01-23 10:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-22 15:21 [PATCH] power: domain: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-01-23 7:44 ` Ulf Hansson
2019-01-23 7:59 ` Greg Kroah-Hartman
2019-01-23 8:20 ` Ulf Hansson
2019-01-23 10:33 ` Greg Kroah-Hartman [this message]
2019-01-23 12:49 ` Ulf Hansson
2019-01-24 10:42 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190123103321.GA17640@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=khilman@kernel.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).