elx: efct: fix pointer error checking in debugfs init
Subsystems (2)
PATCH 1/1 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.
--- drivers/scsi/elx/efct/efct_xport.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/scsi/elx/efct/efct_xport.c +3 -6
@@ -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;
Signature · 1 line
2.26.2
Martin K. Petersen
AppliedJames,
Quoted 3 lines
debugfs_create_xxxroutines, 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 usingIS_ERR()to adapt.
Applied to 5.14/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering