From: Dan Carpenter <dan.carpenter@linaro.org>
To: Ivan Orlov <ivan.orlov0322@gmail.com>, Immad Mir <mirimmad17@gmail.com>
Cc: WANG Xuerui <kernel@xen0n.name>,
Huacai Chen <chenhuacai@kernel.org>,
loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] LoongArch: Delete debugfs checking
Date: Tue, 20 Jun 2023 11:06:34 +0300 [thread overview]
Message-ID: <7627f2b9-2287-46d2-b461-d33aa69931a8@moroto.mountain> (raw)
Debugfs functions are not supposed to be checked for errors. This
is sort of unusual but it is described in the comments for the
debugfs_create_dir() function. Also debugfs_create_dir() can never
return NULL.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
I spotted this code because I was looking at patches which were sent
to stable but without a Fixes tag. The correct way of checking for
error pointers is not IS_ERR_OR_NULL(), it's IS_ERR(). When a function
returns both error pointers and NULL, the NULL should be treated as a
special kind of success. Please see my blog for more details.
https://staticthinking.wordpress.com/2022/08/01/mixing-error-pointers-and-null/
I have not included a Fixes tag here, because it's not really a bug fix,
it's just a clean up.
arch/loongarch/kernel/unaligned.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/loongarch/kernel/unaligned.c b/arch/loongarch/kernel/unaligned.c
index 85fae3d2d71a..3abf163dda05 100644
--- a/arch/loongarch/kernel/unaligned.c
+++ b/arch/loongarch/kernel/unaligned.c
@@ -485,8 +485,6 @@ static int __init debugfs_unaligned(void)
struct dentry *d;
d = debugfs_create_dir("loongarch", NULL);
- if (IS_ERR_OR_NULL(d))
- return -ENOMEM;
debugfs_create_u32("unaligned_instructions_user",
S_IRUGO, d, &unaligned_instructions_user);
--
2.39.2
next reply other threads:[~2023-06-20 8:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-20 8:06 Dan Carpenter [this message]
2023-06-28 14:22 ` WANG Xuerui
2023-06-28 15:37 ` Huacai Chen
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=7627f2b9-2287-46d2-b461-d33aa69931a8@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=chenhuacai@kernel.org \
--cc=ivan.orlov0322@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kernel@xen0n.name \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=mirimmad17@gmail.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®