]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: fnic: Delete incorrect debugfs error handling
authorDan Carpenter <dan.carpenter@linaro.org>
Tue, 7 Jan 2025 13:35:19 +0000 (16:35 +0300)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 10 Jan 2025 23:18:46 +0000 (18:18 -0500)
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>
Link: https://lore.kernel.org/r/a5c237cd-449b-4f9d-bcff-6285fb7c28d1@stanley.mountain
Reviewed-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/fnic/fnic_debugfs.c

index caee32bc9190366f426bf731d27fcb89e69d99bc..5767862ae42feb79c896567e94a8ae22c2661b61 100644 (file)
@@ -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;
 }
 
 /*