public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: jsmart2021@gmail.com
Cc: linux-scsi@vger.kernel.org
Subject: [bug report] scsi: elx: efct: Driver initialization routines
Date: Fri, 18 Jun 2021 16:36:26 +0300	[thread overview]
Message-ID: <YMyhWpF5q0RVgfJU@mwanda> (raw)

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

             reply	other threads:[~2021-06-18 13:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18 13:36 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-06-18  9:16 [bug report] scsi: elx: efct: Driver initialization routines Dan Carpenter

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=YMyhWpF5q0RVgfJU@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=jsmart2021@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    /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