From: "Life is hard, and then you die" <ronald@innovation.ch>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] debugfs: make return value of all debugfs helpers consistent
Date: Mon, 15 Apr 2019 16:29:59 -0700 [thread overview]
Message-ID: <20190415232959.GC13033@innovation.ch> (raw)
In-Reply-To: <20190415084844.GA26101@kroah.com>
Hi Greg,
On Mon, Apr 15, 2019 at 10:48:44AM +0200, Greg Kroah-Hartman wrote:
> On Mon, Apr 15, 2019 at 01:25:06AM -0700, Ronald Tschalär wrote:
> > Since commit ff9fb72bc077 ("debugfs: return error values, not NULL")
> > almost all the debugfs helpers have stopped returning NULL. The lone
> > holdeout was debugfs_create_u32_array(). So fix that.
> >
> > Signed-off-by: Ronald Tschalär <ronald@innovation.ch>
> > ---
> > fs/debugfs/file.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
> > index ddd708b09fa1..bb706d073782 100644
> > --- a/fs/debugfs/file.c
> > +++ b/fs/debugfs/file.c
> > @@ -999,8 +999,8 @@ static const struct file_operations u32_array_fops = {
> > * Once array is created its size can not be changed.
> > *
> > * The function returns a pointer to dentry on success. If an error occurs,
> > - * %ERR_PTR(-ERROR) or NULL will be returned. If debugfs is not enabled in
> > - * the kernel, the value %ERR_PTR(-ENODEV) will be returned.
> > + * %ERR_PTR(-ERROR) will be returned. If debugfs is not enabled in the kernel,
> > + * the value %ERR_PTR(-ENODEV) will be returned.
> > */
> > struct dentry *debugfs_create_u32_array(const char *name, umode_t mode,
> > struct dentry *parent,
> > @@ -1009,7 +1009,7 @@ struct dentry *debugfs_create_u32_array(const char *name, umode_t mode,
> > struct array_data *data = kmalloc(sizeof(*data), GFP_KERNEL);
> >
> > if (data == NULL)
> > - return NULL;
> > + return ERR_PTR(-ENOMEM);
> >
> > data->array = array;
> > data->elements = elements;
>
> There is only one caller of this function in the kernel now, and it does
> not even care about the return value at all, so we should just remove
> the return value entirely as that's the easiest and best thing to do
> here.
Interesting argument: since this is a helper/library function, and
therefore potentially used in the future by others, it seems to me
that consistency with the other functions and providing error feedback
would be important.
> I was going to start doing this slowly over time, but as you are
> touching the function now, might as well do it here :)
Are you saying the plan is to make all these helpers return void?
Cheers,
Ronald
next prev parent reply other threads:[~2019-04-15 23:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-15 8:25 [PATCH 0/2] debugfs helpers cleanups Ronald Tschalär
2019-04-15 8:25 ` [PATCH 1/2] debugfs: update documented return values of debugfs helpers Ronald Tschalär
2019-04-15 8:25 ` [PATCH 2/2] debugfs: make return value of all debugfs helpers consistent Ronald Tschalär
2019-04-15 8:48 ` Greg Kroah-Hartman
2019-04-15 23:29 ` Life is hard, and then you die [this message]
2019-04-16 13:29 ` Greg Kroah-Hartman
2019-04-16 13:46 ` [PATCH] debugfs: make debugfs_create_u32_array() return void Greg Kroah-Hartman
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=20190415232959.GC13033@innovation.ch \
--to=ronald@innovation.ch \
--cc=andriy.shevchenko@linux.intel.com \
--cc=corbet@lwn.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.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 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.