linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Subject: Re: [PATCH] coresight: cpu-debug: no need to check return value of debugfs_create functions
Date: Tue, 18 Jun 2019 11:23:25 -0600	[thread overview]
Message-ID: <CANLsYkzTgwY=EAE8E98jpyO6uVQnKN3SAKhRwSUCRhQTO+rV0w@mail.gmail.com> (raw)
In-Reply-To: <20190618155246.GA17788@kroah.com>

Hi Greg,

On Tue, 18 Jun 2019 at 09:52, 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.

Looking around in the kernel there is no shortage of instances where
the return value of debugfs functions are checked and the logic
altered based on these values.  But there are also just as many that
don't...  It also seems counter intuitive to ignore the return value
of any function, something that in most case is guaranteed to raise
admonition.

That being said I am sure there is a good reason to support your
position - would you mind expanding a little so that I can follow?

Thanks,
Mathieu

>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/hwtracing/coresight/coresight-cpu-debug.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
> index e8819d750938..6446ed69ab2f 100644
> --- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
> +++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
> @@ -525,23 +525,12 @@ static const struct file_operations debug_func_knob_fops = {
>
>  static int debug_func_init(void)
>  {
> -       struct dentry *file;
>         int ret;
>
>         /* Create debugfs node */
>         debug_debugfs_dir = debugfs_create_dir("coresight_cpu_debug", NULL);
> -       if (!debug_debugfs_dir) {
> -               pr_err("%s: unable to create debugfs directory\n", __func__);
> -               return -ENOMEM;
> -       }
> -
> -       file = debugfs_create_file("enable", 0644, debug_debugfs_dir, NULL,
> -                                  &debug_func_knob_fops);
> -       if (!file) {
> -               pr_err("%s: unable to create enable knob file\n", __func__);
> -               ret = -ENOMEM;
> -               goto err;
> -       }
> +       debugfs_create_file("enable", 0644, debug_debugfs_dir, NULL,
> +                           &debug_func_knob_fops);
>
>         /* Register function to be called for panic */
>         ret = atomic_notifier_chain_register(&panic_notifier_list,
> --
> 2.22.0
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-06-18 17:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-18 15:52 [PATCH] coresight: cpu-debug: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-06-18 17:23 ` Mathieu Poirier [this message]
2019-06-18 17:46   ` Greg Kroah-Hartman
2019-06-18 17:52     ` Greg Kroah-Hartman
2019-06-18 19:26     ` Mathieu Poirier
2019-06-19 15:27       ` 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='CANLsYkzTgwY=EAE8E98jpyO6uVQnKN3SAKhRwSUCRhQTO+rV0w@mail.gmail.com' \
    --to=mathieu.poirier@linaro.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=suzuki.poulose@arm.com \
    /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).