[bug report] scsi: elx: efct: Driver initialization routines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello James Smart,

The patch 4df84e846624: "scsi: elx: efct: Driver initialization
routines" from Jun 1, 2021, leads to the following static checker
warning:

	drivers/scsi/elx/efct/efct_xport.c:46 efct_xport_init_debugfs()
	warn: 'efct_debugfs_root' is an error pointer or valid

drivers/scsi/elx/efct/efct_xport.c
    39  static int
    40  efct_xport_init_debugfs(struct efct *efct)
    41  {
    42          /* Setup efct debugfs root directory */
    43          if (!efct_debugfs_root) {
    44                  efct_debugfs_root = debugfs_create_dir("efct", NULL);
    45                  atomic_set(&efct_debugfs_count, 0);
    46                  if (!efct_debugfs_root) {
    47                          efc_log_err(efct, "failed to create debugfs entry\n");
    48                          goto debugfs_fail;
    49                  }

This test can just be deleted.  We don't need to check for IS_ERR()
because it's okay if it fails.  Normally, drivers are not supposed to
check the return from debugfs_create_dir().

    50          }
    51  
    52          /* Create a directory for sessions in root */
    53          if (!efct->sess_debugfs_dir) {
    54                  efct->sess_debugfs_dir = debugfs_create_dir("sessions", NULL);
                                                                                ^^^^
This should be "efct_debugfs_root"


    55                  if (!efct->sess_debugfs_dir) {

Here, we do care so it should be updated to if (IS_ERR(efct->sess_debugfs_dir)) {

    56                          efc_log_err(efct,
    57                                      "failed to create debugfs entry for sessions\n");
    58                          goto debugfs_fail;
    59                  }
    60                  atomic_inc(&efct_debugfs_count);
    61          }
    62  
    63          return 0;
    64  
    65  debugfs_fail:
    66          return -EIO;
    67  }

regards,
dan carpenter



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux