Skip to contentSkip to conversation

scsi: qla2xxx: Setup debugfs entries for remote ports

bug report Dan Carpenter 2 participants 2 messages Sep 24, 2020 SCSI

lore
Share & tools
lore
#0 lore raw

Hello Arun Easi,

The patch 1e98fb0f9208: "scsi: qla2xxx: Setup debugfs entries for remote ports" from Sep 3, 2020, leads to the following static checker warning:

	drivers/scsi/qla2xxx/qla_dfs.c:119 qla2x00_dfs_create_rport()
	warn: 'fp->dfs_rport_dir' is an error pointer or valid

drivers/scsi/qla2xxx/qla_dfs.c
106 qla2x00_dfs_create_rport(scsi_qla_host_t *vha, struct fc_port *fp) 107 {
108 char wwn[32];
109
110 #define QLA_CREATE_RPORT_FIELD_ATTR(_attr) \
111 debugfs_create_file(#_attr, 0400, fp->dfs_rport_dir, \
112 fp, &qla_dfs_rport_field_##_attr##_fops)
113
114 if (!vha->dfs_rport_root || fp->dfs_rport_dir)
115 return;
116

   117          sprintf(wwn, "pn-%016llx", wwn_to_u64(fp->port_name));
   118          fp->dfs_rport_dir = debugfs_create_dir(wwn, vha->dfs_rport_root);
   119          if (!fp->dfs_rport_dir)

Just delete this test. Debugfs functions are not supposed to be checked in the normal case.

120 return;
121 if (NVME_TARGET(vha->hw, fp))
122 debugfs_create_file("dev_loss_tmo", 0600, fp->dfs_rport_dir,

The debugfs_create_file() function has it's own checks built in so no need to check.

   123                                      fp, &qla_dfs_rport_dev_loss_tmo_fops);
   124  
   125          QLA_CREATE_RPORT_FIELD_ATTR(disc_state);
   126          QLA_CREATE_RPORT_FIELD_ATTR(scan_state);
   127          QLA_CREATE_RPORT_FIELD_ATTR(fw_login_state);

regards,
dan carpenter

#1 lore raw
Quoted 26 lines · Dan Carpenter

----------------------------------------------------------------------
Hello Arun Easi,

The patch 1e98fb0f9208: "scsi: qla2xxx: Setup debugfs entries for remote ports" from Sep 3, 2020, leads to the following static checker warning:

	drivers/scsi/qla2xxx/qla_dfs.c:119 qla2x00_dfs_create_rport()
	warn: 'fp->dfs_rport_dir' is an error pointer or valid

drivers/scsi/qla2xxx/qla_dfs.c
106 qla2x00_dfs_create_rport(scsi_qla_host_t *vha, struct fc_port *fp)

   107  {
   108          char wwn[32];
   109  
   110  #define QLA_CREATE_RPORT_FIELD_ATTR(_attr)                      \
   111          debugfs_create_file(#_attr, 0400, fp->dfs_rport_dir,    \
   112                  fp, &qla_dfs_rport_field_##_attr##_fops)
   113  
   114          if (!vha->dfs_rport_root || fp->dfs_rport_dir)
   115                  return;
   116  
   117          sprintf(wwn, "pn-%016llx", wwn_to_u64(fp->port_name));
   118          fp->dfs_rport_dir = debugfs_create_dir(wwn, vha->dfs_rport_root);
   119          if (!fp->dfs_rport_dir)
Quoted 2 lines

Just delete this test. Debugfs functions are not supposed to be checked in the normal case.

Thanks Dan for reporting. I will make the change and post a separate patch.

Regards,
-Arun