Commit ae3272ec authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: elx: efct: Fix pointer error checking in debugfs init

debugfs_create_xxx routines, which return pointers, are being checked for
error by looking for NULL values. The routines may return pointer-munged
-Exxx codes, so they should be using IS_ERR() to adapt.

There are two cases:

 - The first case is on initial directory creation, which actually doesn't
   need to be checked. So remove the check.

 - Creation of the sessions subdirectory. Modify this creation to create
   under the initial directory created, and fix failure check.

Link: https://lore.kernel.org/r/20210618233004.83769-1-jsmart2021@gmail.com
Fixes: 4df84e84 ("scsi: elx: efct: Driver initialization routines")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent ca7f33c6
...@@ -43,16 +43,13 @@ efct_xport_init_debugfs(struct efct *efct) ...@@ -43,16 +43,13 @@ efct_xport_init_debugfs(struct efct *efct)
if (!efct_debugfs_root) { if (!efct_debugfs_root) {
efct_debugfs_root = debugfs_create_dir("efct", NULL); efct_debugfs_root = debugfs_create_dir("efct", NULL);
atomic_set(&efct_debugfs_count, 0); atomic_set(&efct_debugfs_count, 0);
if (!efct_debugfs_root) {
efc_log_err(efct, "failed to create debugfs entry\n");
goto debugfs_fail;
}
} }
/* Create a directory for sessions in root */ /* Create a directory for sessions in root */
if (!efct->sess_debugfs_dir) { if (!efct->sess_debugfs_dir) {
efct->sess_debugfs_dir = debugfs_create_dir("sessions", NULL); efct->sess_debugfs_dir = debugfs_create_dir("sessions",
if (!efct->sess_debugfs_dir) { efct_debugfs_root);
if (IS_ERR(efct->sess_debugfs_dir)) {
efc_log_err(efct, efc_log_err(efct,
"failed to create debugfs entry for sessions\n"); "failed to create debugfs entry for sessions\n");
goto debugfs_fail; goto debugfs_fail;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment