From: Jonathan Cameron <jic23@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: core: no need to check return value of debugfs_create functions
Date: Sat, 22 Jun 2019 10:44:47 +0100 [thread overview]
Message-ID: <20190622104447.37cbdf57@archlinux> (raw)
In-Reply-To: <20190618155440.GA20071@kroah.com>
On Tue, 18 Jun 2019 17:54:40 +0200
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.
>
> Cc: Jonathan Cameron <jic23@kernel.org>
> Cc: Hartmut Knaack <knaack.h@gmx.de>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
> Cc: linux-iio@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to poke it a bit.
Thanks,
Jonathan
> ---
> drivers/iio/industrialio-core.c | 35 ++++++++-------------------------
> 1 file changed, 8 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index f5a4581302f4..503970137590 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -369,39 +369,25 @@ static void iio_device_unregister_debugfs(struct iio_dev *indio_dev)
> debugfs_remove_recursive(indio_dev->debugfs_dentry);
> }
>
> -static int iio_device_register_debugfs(struct iio_dev *indio_dev)
> +static void iio_device_register_debugfs(struct iio_dev *indio_dev)
> {
> - struct dentry *d;
> -
> if (indio_dev->info->debugfs_reg_access == NULL)
> - return 0;
> + return;
>
> if (!iio_debugfs_dentry)
> - return 0;
> + return;
>
> indio_dev->debugfs_dentry =
> debugfs_create_dir(dev_name(&indio_dev->dev),
> iio_debugfs_dentry);
> - if (indio_dev->debugfs_dentry == NULL) {
> - dev_warn(indio_dev->dev.parent,
> - "Failed to create debugfs directory\n");
> - return -EFAULT;
> - }
> -
> - d = debugfs_create_file("direct_reg_access", 0644,
> - indio_dev->debugfs_dentry,
> - indio_dev, &iio_debugfs_reg_fops);
> - if (!d) {
> - iio_device_unregister_debugfs(indio_dev);
> - return -ENOMEM;
> - }
>
> - return 0;
> + debugfs_create_file("direct_reg_access", 0644,
> + indio_dev->debugfs_dentry, indio_dev,
> + &iio_debugfs_reg_fops);
> }
> #else
> -static int iio_device_register_debugfs(struct iio_dev *indio_dev)
> +static void iio_device_register_debugfs(struct iio_dev *indio_dev)
> {
> - return 0;
> }
>
> static void iio_device_unregister_debugfs(struct iio_dev *indio_dev)
> @@ -1672,12 +1658,7 @@ int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod)
> /* configure elements for the chrdev */
> indio_dev->dev.devt = MKDEV(MAJOR(iio_devt), indio_dev->id);
>
> - ret = iio_device_register_debugfs(indio_dev);
> - if (ret) {
> - dev_err(indio_dev->dev.parent,
> - "Failed to register debugfs interfaces\n");
> - return ret;
> - }
> + iio_device_register_debugfs(indio_dev);
>
> ret = iio_buffer_alloc_sysfs_and_mask(indio_dev);
> if (ret) {
prev parent reply other threads:[~2019-06-22 9:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-18 15:54 [PATCH] iio: core: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-06-22 9:44 ` Jonathan Cameron [this message]
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=20190622104447.37cbdf57@archlinux \
--to=jic23@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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.