scsi: lpfc: no need to check return value of debugfs_create functions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jan 2019 15:09:04 +0000 (16:09 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 29 Jan 2019 05:40:54 +0000 (00:40 -0500)
When calling debugfs functions, there is no need to ever check the return
value.  The function can work or not, but the code logic should never do
something different based on this.

Cc: James Smart <james.smart@broadcom.com>
Cc: Dick Kennedy <dick.kennedy@broadcom.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_debugfs.c

index a58f0b3f03a92cc6c54f1f4f91e592b20735bc1e..a851dee095873d5b347d129f2a9ec3db28a371be 100644 (file)
@@ -5280,11 +5280,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
        if (!lpfc_debugfs_root) {
                lpfc_debugfs_root = debugfs_create_dir("lpfc", NULL);
                atomic_set(&lpfc_debugfs_hba_count, 0);
-               if (!lpfc_debugfs_root) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                        "0408 Cannot create debugfs root\n");
-                       goto debug_failed;
-               }
        }
        if (!lpfc_debugfs_start_time)
                lpfc_debugfs_start_time = jiffies;
@@ -5295,11 +5290,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                pport_setup = true;
                phba->hba_debugfs_root =
                        debugfs_create_dir(name, lpfc_debugfs_root);
-               if (!phba->hba_debugfs_root) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                        "0412 Cannot create debugfs hba\n");
-                       goto debug_failed;
-               }
                atomic_inc(&lpfc_debugfs_hba_count);
                atomic_set(&phba->debugfs_vport_count, 0);
 
@@ -5309,11 +5299,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                                 phba->hba_debugfs_root,
                                 phba, &lpfc_debugfs_op_hbqinfo);
-               if (!phba->debug_hbqinfo) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                               "0411 Cannot create debugfs hbqinfo\n");
-                       goto debug_failed;
-               }
 
                /* Setup dumpHBASlim */
                if (phba->sli_rev < LPFC_SLI_REV4) {
@@ -5323,12 +5308,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                                        S_IFREG|S_IRUGO|S_IWUSR,
                                        phba->hba_debugfs_root,
                                        phba, &lpfc_debugfs_op_dumpHBASlim);
-                       if (!phba->debug_dumpHBASlim) {
-                               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                                "0413 Cannot create debugfs "
-                                               "dumpHBASlim\n");
-                               goto debug_failed;
-                       }
                } else
                        phba->debug_dumpHBASlim = NULL;
 
@@ -5340,12 +5319,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                                        S_IFREG|S_IRUGO|S_IWUSR,
                                        phba->hba_debugfs_root,
                                        phba, &lpfc_debugfs_op_dumpHostSlim);
-                       if (!phba->debug_dumpHostSlim) {
-                               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                                "0414 Cannot create debugfs "
-                                                "dumpHostSlim\n");
-                               goto debug_failed;
-                       }
                } else
                        phba->debug_dumpHostSlim = NULL;
 
@@ -5355,11 +5328,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                                 phba->hba_debugfs_root,
                                 phba, &lpfc_debugfs_op_dumpData);
-               if (!phba->debug_dumpData) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                               "0800 Cannot create debugfs dumpData\n");
-                       goto debug_failed;
-               }
 
                /* Setup dumpDif */
                snprintf(name, sizeof(name), "dumpDif");
@@ -5367,11 +5335,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                                 phba->hba_debugfs_root,
                                 phba, &lpfc_debugfs_op_dumpDif);
-               if (!phba->debug_dumpDif) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                               "0801 Cannot create debugfs dumpDif\n");
-                       goto debug_failed;
-               }
 
                /* Setup DIF Error Injections */
                snprintf(name, sizeof(name), "InjErrLBA");
@@ -5379,11 +5342,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                        phba->hba_debugfs_root,
                        phba, &lpfc_debugfs_op_dif_err);
-               if (!phba->debug_InjErrLBA) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                               "0807 Cannot create debugfs InjErrLBA\n");
-                       goto debug_failed;
-               }
                phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF;
 
                snprintf(name, sizeof(name), "InjErrNPortID");
@@ -5391,88 +5349,48 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                        phba->hba_debugfs_root,
                        phba, &lpfc_debugfs_op_dif_err);
-               if (!phba->debug_InjErrNPortID) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                               "0809 Cannot create debugfs InjErrNPortID\n");
-                       goto debug_failed;
-               }
 
                snprintf(name, sizeof(name), "InjErrWWPN");
                phba->debug_InjErrWWPN =
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                        phba->hba_debugfs_root,
                        phba, &lpfc_debugfs_op_dif_err);
-               if (!phba->debug_InjErrWWPN) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                               "0810 Cannot create debugfs InjErrWWPN\n");
-                       goto debug_failed;
-               }
 
                snprintf(name, sizeof(name), "writeGuardInjErr");
                phba->debug_writeGuard =
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                        phba->hba_debugfs_root,
                        phba, &lpfc_debugfs_op_dif_err);
-               if (!phba->debug_writeGuard) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                               "0802 Cannot create debugfs writeGuard\n");
-                       goto debug_failed;
-               }
 
                snprintf(name, sizeof(name), "writeAppInjErr");
                phba->debug_writeApp =
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                        phba->hba_debugfs_root,
                        phba, &lpfc_debugfs_op_dif_err);
-               if (!phba->debug_writeApp) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                               "0803 Cannot create debugfs writeApp\n");
-                       goto debug_failed;
-               }
 
                snprintf(name, sizeof(name), "writeRefInjErr");
                phba->debug_writeRef =
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                        phba->hba_debugfs_root,
                        phba, &lpfc_debugfs_op_dif_err);
-               if (!phba->debug_writeRef) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                               "0804 Cannot create debugfs writeRef\n");
-                       goto debug_failed;
-               }
 
                snprintf(name, sizeof(name), "readGuardInjErr");
                phba->debug_readGuard =
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                        phba->hba_debugfs_root,
                        phba, &lpfc_debugfs_op_dif_err);
-               if (!phba->debug_readGuard) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                               "0808 Cannot create debugfs readGuard\n");
-                       goto debug_failed;
-               }
 
                snprintf(name, sizeof(name), "readAppInjErr");
                phba->debug_readApp =
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                        phba->hba_debugfs_root,
                        phba, &lpfc_debugfs_op_dif_err);
-               if (!phba->debug_readApp) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                               "0805 Cannot create debugfs readApp\n");
-                       goto debug_failed;
-               }
 
                snprintf(name, sizeof(name), "readRefInjErr");
                phba->debug_readRef =
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                        phba->hba_debugfs_root,
                        phba, &lpfc_debugfs_op_dif_err);
-               if (!phba->debug_readRef) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                               "0806 Cannot create debugfs readApp\n");
-                       goto debug_failed;
-               }
 
                /* Setup slow ring trace */
                if (lpfc_debugfs_max_slow_ring_trc) {
@@ -5496,12 +5414,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                                 phba->hba_debugfs_root,
                                 phba, &lpfc_debugfs_op_slow_ring_trc);
-               if (!phba->debug_slow_ring_trc) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                        "0415 Cannot create debugfs "
-                                        "slow_ring_trace\n");
-                       goto debug_failed;
-               }
                if (!phba->slow_ring_trc) {
                        phba->slow_ring_trc = kmalloc(
                                (sizeof(struct lpfc_debugfs_trc) *
@@ -5524,11 +5436,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                        debugfs_create_file(name, 0644,
                                            phba->hba_debugfs_root,
                                            phba, &lpfc_debugfs_op_nvmeio_trc);
-               if (!phba->debug_nvmeio_trc) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                        "0574 No create debugfs nvmeio_trc\n");
-                       goto debug_failed;
-               }
 
                atomic_set(&phba->nvmeio_trc_cnt, 0);
                if (lpfc_debugfs_max_nvmeio_trc) {
@@ -5576,11 +5483,6 @@ nvmeio_off:
        if (!vport->vport_debugfs_root) {
                vport->vport_debugfs_root =
                        debugfs_create_dir(name, phba->hba_debugfs_root);
-               if (!vport->vport_debugfs_root) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                        "0417 Can't create debugfs\n");
-                       goto debug_failed;
-               }
                atomic_inc(&phba->debugfs_vport_count);
        }
 
@@ -5617,55 +5519,29 @@ nvmeio_off:
                debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                                 vport->vport_debugfs_root,
                                 vport, &lpfc_debugfs_op_disc_trc);
-       if (!vport->debug_disc_trc) {
-               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                "0419 Cannot create debugfs "
-                                "discovery_trace\n");
-               goto debug_failed;
-       }
        snprintf(name, sizeof(name), "nodelist");
        vport->debug_nodelist =
                debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                                 vport->vport_debugfs_root,
                                 vport, &lpfc_debugfs_op_nodelist);
-       if (!vport->debug_nodelist) {
-               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                "2985 Can't create debugfs nodelist\n");
-               goto debug_failed;
-       }
 
        snprintf(name, sizeof(name), "nvmestat");
        vport->debug_nvmestat =
                debugfs_create_file(name, 0644,
                                    vport->vport_debugfs_root,
                                    vport, &lpfc_debugfs_op_nvmestat);
-       if (!vport->debug_nvmestat) {
-               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                "0811 Cannot create debugfs nvmestat\n");
-               goto debug_failed;
-       }
 
        snprintf(name, sizeof(name), "nvmektime");
        vport->debug_nvmektime =
                debugfs_create_file(name, 0644,
                                    vport->vport_debugfs_root,
                                    vport, &lpfc_debugfs_op_nvmektime);
-       if (!vport->debug_nvmektime) {
-               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                "0815 Cannot create debugfs nvmektime\n");
-               goto debug_failed;
-       }
 
        snprintf(name, sizeof(name), "cpucheck");
        vport->debug_cpucheck =
                debugfs_create_file(name, 0644,
                                    vport->vport_debugfs_root,
                                    vport, &lpfc_debugfs_op_cpucheck);
-       if (!vport->debug_cpucheck) {
-               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                "0819 Cannot create debugfs cpucheck\n");
-               goto debug_failed;
-       }
 
        /*
         * The following section is for additional directories/files for the
@@ -5685,11 +5561,6 @@ nvmeio_off:
        if (!phba->idiag_root) {
                phba->idiag_root =
                        debugfs_create_dir(name, phba->hba_debugfs_root);
-               if (!phba->idiag_root) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                        "2922 Can't create idiag debugfs\n");
-                       goto debug_failed;
-               }
                /* Initialize iDiag data structure */
                memset(&idiag, 0, sizeof(idiag));
        }
@@ -5700,11 +5571,6 @@ nvmeio_off:
                phba->idiag_pci_cfg =
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                                phba->idiag_root, phba, &lpfc_idiag_op_pciCfg);
-               if (!phba->idiag_pci_cfg) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                        "2923 Can't create idiag debugfs\n");
-                       goto debug_failed;
-               }
                idiag.offset.last_rd = 0;
        }
 
@@ -5714,11 +5580,6 @@ nvmeio_off:
                phba->idiag_bar_acc =
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                                phba->idiag_root, phba, &lpfc_idiag_op_barAcc);
-               if (!phba->idiag_bar_acc) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                       "3056 Can't create idiag debugfs\n");
-                       goto debug_failed;
-               }
                idiag.offset.last_rd = 0;
        }
 
@@ -5728,11 +5589,6 @@ nvmeio_off:
                phba->idiag_que_info =
                        debugfs_create_file(name, S_IFREG|S_IRUGO,
                        phba->idiag_root, phba, &lpfc_idiag_op_queInfo);
-               if (!phba->idiag_que_info) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                        "2924 Can't create idiag debugfs\n");
-                       goto debug_failed;
-               }
        }
 
        /* iDiag access PCI function queue */
@@ -5741,11 +5597,6 @@ nvmeio_off:
                phba->idiag_que_acc =
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                                phba->idiag_root, phba, &lpfc_idiag_op_queAcc);
-               if (!phba->idiag_que_acc) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                        "2926 Can't create idiag debugfs\n");
-                       goto debug_failed;
-               }
        }
 
        /* iDiag access PCI function doorbell registers */
@@ -5754,11 +5605,6 @@ nvmeio_off:
                phba->idiag_drb_acc =
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                                phba->idiag_root, phba, &lpfc_idiag_op_drbAcc);
-               if (!phba->idiag_drb_acc) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                        "2927 Can't create idiag debugfs\n");
-                       goto debug_failed;
-               }
        }
 
        /* iDiag access PCI function control registers */
@@ -5767,11 +5613,6 @@ nvmeio_off:
                phba->idiag_ctl_acc =
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                                phba->idiag_root, phba, &lpfc_idiag_op_ctlAcc);
-               if (!phba->idiag_ctl_acc) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                        "2981 Can't create idiag debugfs\n");
-                       goto debug_failed;
-               }
        }
 
        /* iDiag access mbox commands */
@@ -5780,11 +5621,6 @@ nvmeio_off:
                phba->idiag_mbx_acc =
                        debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
                                phba->idiag_root, phba, &lpfc_idiag_op_mbxAcc);
-               if (!phba->idiag_mbx_acc) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                       "2980 Can't create idiag debugfs\n");
-                       goto debug_failed;
-               }
        }
 
        /* iDiag extents access commands */
@@ -5796,12 +5632,6 @@ nvmeio_off:
                                                    S_IFREG|S_IRUGO|S_IWUSR,
                                                    phba->idiag_root, phba,
                                                    &lpfc_idiag_op_extAcc);
-                       if (!phba->idiag_ext_acc) {
-                               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-                                               "2986 Cant create "
-                                               "idiag debugfs\n");
-                               goto debug_failed;
-                       }
                }
        }