summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/elx
diff options
context:
space:
mode:
authorJames Smart <jsmart2021@gmail.com>2021-06-19 01:30:04 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2021-06-19 05:01:04 +0200
commitae3272ec5e9772de143b6326b2c3a61529786ddd (patch)
treead973f25c892b6ce158b28d7fc310a28729ff274 /drivers/scsi/elx
parentscsi: elx: efct: Fix is_originator return code type (diff)
downloadlinux-ae3272ec5e9772de143b6326b2c3a61529786ddd.tar.xz
linux-ae3272ec5e9772de143b6326b2c3a61529786ddd.zip
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: 4df84e846624 ("scsi: elx: efct: Driver initialization routines") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/elx')
-rw-r--r--drivers/scsi/elx/efct/efct_xport.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/scsi/elx/efct/efct_xport.c b/drivers/scsi/elx/efct/efct_xport.c
index 78b6a47599c3..9495cedcc0b9 100644
--- a/drivers/scsi/elx/efct/efct_xport.c
+++ b/drivers/scsi/elx/efct/efct_xport.c
@@ -43,16 +43,13 @@ efct_xport_init_debugfs(struct efct *efct)
if (!efct_debugfs_root) {
efct_debugfs_root = debugfs_create_dir("efct", NULL);
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 */
if (!efct->sess_debugfs_dir) {
- efct->sess_debugfs_dir = debugfs_create_dir("sessions", NULL);
- if (!efct->sess_debugfs_dir) {
+ efct->sess_debugfs_dir = debugfs_create_dir("sessions",
+ efct_debugfs_root);
+ if (IS_ERR(efct->sess_debugfs_dir)) {
efc_log_err(efct,
"failed to create debugfs entry for sessions\n");
goto debugfs_fail;