mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Yang Ruibin <11162571@vivo.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, opensource.kernel@vivo.com
Subject: Re: [PATCH v1] lib:Fix the NULL vs IS_ERR() bug for debugfs_create_dir()
Date: Fri, 23 Aug 2024 00:24:10 +0300	[thread overview]
Message-ID: <Zsesertnqs_KhRd4@surfacebook.localdomain> (raw)
In-Reply-To: <20240821073441.9701-1-11162571@vivo.com>

Wed, Aug 21, 2024 at 03:34:40AM -0400, Yang Ruibin kirjoitti:
> The debugfs_create_dir() function returns error pointers.
> It never returns NULL. So use IS_ERR() to check it.

>  	selftest_dir = debugfs_create_dir("selftest_helpers", NULL);
> -	if (!selftest_dir)
> +	if (IS_ERR(selftest_dir))
>  		return -ENOMEM;

With this you most likely want to propagate error code to the caller

		return PTR_ERR(selftest_dir);

BUT, we usually don't check debugfs error codes as the program should work
anyway. Does this test case actually _rely_ on debugfs to be functional?

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2024-08-22 21:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21  7:34 Yang Ruibin
2024-08-22 21:24 ` Andy Shevchenko [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=Zsesertnqs_KhRd4@surfacebook.localdomain \
    --to=andy.shevchenko@gmail.com \
    --cc=11162571@vivo.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=opensource.kernel@vivo.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

all inboxes | Powered by JetHome®