From: Dan Carpenter <dan.carpenter@linaro.org>
To: Karan Tilak Kumar <kartilak@cisco.com>
Cc: Sesidhar Baddela <sebaddel@cisco.com>,
"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] scsi: fnic: delete incorrect debugfs error handling
Date: Tue, 7 Jan 2025 16:35:19 +0300 [thread overview]
Message-ID: <a5c237cd-449b-4f9d-bcff-6285fb7c28d1@stanley.mountain> (raw)
Debugfs functions are not supposed to require error checking and,
in fact, adding checks would normally lead to the driver refusing to load
when CONFIG_DEBUGFS is disabled.
What saves us here is that this code checks for NULL instead of
error pointers so the error checking is all dead code. Delete it.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/scsi/fnic/fnic_debugfs.c | 25 +------------------------
1 file changed, 1 insertion(+), 24 deletions(-)
diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c
index caee32bc9190..5767862ae42f 100644
--- a/drivers/scsi/fnic/fnic_debugfs.c
+++ b/drivers/scsi/fnic/fnic_debugfs.c
@@ -679,46 +679,23 @@ static const struct file_operations fnic_reset_debugfs_fops = {
*/
int fnic_stats_debugfs_init(struct fnic *fnic)
{
- int rc = -1;
char name[16];
snprintf(name, sizeof(name), "host%d", fnic->host->host_no);
- if (!fnic_stats_debugfs_root) {
- pr_debug("fnic_stats root doesn't exist\n");
- return rc;
- }
-
fnic->fnic_stats_debugfs_host = debugfs_create_dir(name,
fnic_stats_debugfs_root);
-
- if (!fnic->fnic_stats_debugfs_host) {
- pr_debug("Cannot create host directory\n");
- return rc;
- }
-
fnic->fnic_stats_debugfs_file = debugfs_create_file("stats",
S_IFREG|S_IRUGO|S_IWUSR,
fnic->fnic_stats_debugfs_host,
fnic,
&fnic_stats_debugfs_fops);
-
- if (!fnic->fnic_stats_debugfs_file) {
- pr_debug("Cannot create host stats file\n");
- return rc;
- }
-
fnic->fnic_reset_debugfs_file = debugfs_create_file("reset_stats",
S_IFREG|S_IRUGO|S_IWUSR,
fnic->fnic_stats_debugfs_host,
fnic,
&fnic_reset_debugfs_fops);
- if (!fnic->fnic_reset_debugfs_file) {
- pr_debug("Cannot create host stats file\n");
- return rc;
- }
- rc = 0;
- return rc;
+ return 0;
}
/*
--
2.45.2
next reply other threads:[~2025-01-07 13:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 13:35 Dan Carpenter [this message]
2025-01-08 2:53 ` Karan Tilak Kumar (kartilak)
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=a5c237cd-449b-4f9d-bcff-6285fb7c28d1@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=kartilak@cisco.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sebaddel@cisco.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®