From: Wang Ming <machel@vivo.com>
To: Wang Ming <machel@vivo.com>, linux-kernel@vger.kernel.org
Cc: opensource.kernel@vivo.com
Subject: [PATCH v2] lib:Fix more error checking for debugfs_create_dir()
Date: Tue, 11 Jul 2023 19:16:58 +0800 [thread overview]
Message-ID: <20230711111727.2672-1-machel@vivo.com> (raw)
In case of failure, debugfs_create_dir() does not return NULL,
but an error pointer. Most incorrect error checks were fixed,
but the one in test_fpu_init() was forgotten.
Fix the remaining error check.
Signed-off-by: Wang Ming <machel@vivo.com>
---
lib/test_fpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/test_fpu.c b/lib/test_fpu.c
index e82db19fed84..5d6aa4691b4a 100644
--- a/lib/test_fpu.c
+++ b/lib/test_fpu.c
@@ -69,7 +69,7 @@ static struct dentry *selftest_dir;
static int __init test_fpu_init(void)
{
selftest_dir = debugfs_create_dir("selftest_helpers", NULL);
- if (!selftest_dir)
+ if (IS_ERR(selftest_dir))
return -ENOMEM;
debugfs_create_file_unsafe("test_fpu", 0444, selftest_dir, NULL,
--
2.25.1
next reply other threads:[~2023-07-11 11:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 11:16 Wang Ming [this message]
2023-07-11 19:33 ` Randy Dunlap
[not found] ` <SG2PR06MB3743963CD8DA3A48FC6C2122BD36A@SG2PR06MB3743.apcprd06.prod.outlook.com>
2023-07-12 2:58 ` 回复: " Randy Dunlap
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=20230711111727.2672-1-machel@vivo.com \
--to=machel@vivo.com \
--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®