* [PATCH] scsi: lpfc: fix error check return value of debugfs_create_file()
@ 2022-04-19 1:45 cgel.zte
2022-04-26 13:06 ` Martin K. Petersen
0 siblings, 1 reply; 4+ messages in thread
From: cgel.zte @ 2022-04-19 1:45 UTC (permalink / raw)
To: james.smart, dick.kennedy
Cc: jejb, martin.petersen, linux-scsi, linux-kernel, Lv Ruyi, Zeal Robot
From: Lv Ruyi <lv.ruyi@zte.com.cn>
If an error occurs, debugfs_create_file() will return ERR_PTR(-ERROR),
so use IS_ERR() to check it.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
drivers/scsi/lpfc/lpfc_debugfs.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 7b24c932e812..c57f80191b34 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -6105,7 +6105,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
phba->hba_debugfs_root,
phba,
&lpfc_debugfs_op_multixripools);
- if (!phba->debug_multixri_pools) {
+ if (IS_ERR(phba->debug_multixri_pools)) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
"0527 Cannot create debugfs multixripools\n");
goto debug_failed;
@@ -6117,7 +6117,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
debugfs_create_file(name, S_IFREG | 0644,
phba->hba_debugfs_root,
phba, &lpfc_cgn_buffer_op);
- if (!phba->debug_cgn_buffer) {
+ if (IS_ERR(phba->debug_cgn_buffer)) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
"6527 Cannot create debugfs "
"cgn_buffer\n");
@@ -6130,7 +6130,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
debugfs_create_file(name, S_IFREG | 0644,
phba->hba_debugfs_root,
phba, &lpfc_rx_monitor_op);
- if (!phba->debug_rx_monitor) {
+ if (IS_ERR(phba->debug_rx_monitor)) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
"6528 Cannot create debugfs "
"rx_monitor\n");
@@ -6143,7 +6143,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
debugfs_create_file(name, 0644,
phba->hba_debugfs_root,
phba, &lpfc_debugfs_ras_log);
- if (!phba->debug_ras_log) {
+ if (IS_ERR(phba->debug_ras_log)) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
"6148 Cannot create debugfs"
" ras_log\n");
@@ -6164,7 +6164,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
debugfs_create_file(name, S_IFREG | 0644,
phba->hba_debugfs_root,
phba, &lpfc_debugfs_op_lockstat);
- if (!phba->debug_lockstat) {
+ if (IS_ERR(phba->debug_lockstat)) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
"4610 Can't create debugfs lockstat\n");
goto debug_failed;
@@ -6390,7 +6390,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
debugfs_create_file(name, 0644,
vport->vport_debugfs_root,
vport, &lpfc_debugfs_op_scsistat);
- if (!vport->debug_scsistat) {
+ if (IS_ERR(vport->debug_scsistat)) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
"4611 Cannot create debugfs scsistat\n");
goto debug_failed;
@@ -6401,7 +6401,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
debugfs_create_file(name, 0644,
vport->vport_debugfs_root,
vport, &lpfc_debugfs_op_ioktime);
- if (!vport->debug_ioktime) {
+ if (IS_ERR(vport->debug_ioktime)) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
"0815 Cannot create debugfs ioktime\n");
goto debug_failed;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: lpfc: fix error check return value of debugfs_create_file()
2022-04-19 1:45 [PATCH] scsi: lpfc: fix error check return value of debugfs_create_file() cgel.zte
@ 2022-04-26 13:06 ` Martin K. Petersen
2022-04-27 2:16 ` cgel.zte
0 siblings, 1 reply; 4+ messages in thread
From: Martin K. Petersen @ 2022-04-26 13:06 UTC (permalink / raw)
To: cgel.zte
Cc: james.smart, dick.kennedy, jejb, martin.petersen, linux-scsi,
linux-kernel, Lv Ruyi, Zeal Robot
> If an error occurs, debugfs_create_file() will return ERR_PTR(-ERROR),
> so use IS_ERR() to check it.
Applied to 5.19/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: lpfc: fix error check return value of debugfs_create_file()
2022-04-26 13:06 ` Martin K. Petersen
@ 2022-04-27 2:16 ` cgel.zte
2022-04-27 2:24 ` Martin K. Petersen
0 siblings, 1 reply; 4+ messages in thread
From: cgel.zte @ 2022-04-27 2:16 UTC (permalink / raw)
To: martin.petersen
Cc: cgel.zte, dick.kennedy, james.smart, jejb, linux-kernel,
linux-scsi, lv.ruyi
So sorry, please ignore this patch.
Andrew pointed that we shouldn't check return value of debugfs_.
https://lore.kernel.org/all/Yl8v6OcArfqmVYj%2F@lunn.ch/
Thanks
Ruyi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: lpfc: fix error check return value of debugfs_create_file()
2022-04-27 2:16 ` cgel.zte
@ 2022-04-27 2:24 ` Martin K. Petersen
0 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-04-27 2:24 UTC (permalink / raw)
To: cgel.zte
Cc: martin.petersen, dick.kennedy, james.smart, jejb, linux-kernel,
linux-scsi, lv.ruyi
> So sorry, please ignore this patch.
OK, dropped.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-27 2:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19 1:45 [PATCH] scsi: lpfc: fix error check return value of debugfs_create_file() cgel.zte
2022-04-26 13:06 ` Martin K. Petersen
2022-04-27 2:16 ` cgel.zte
2022-04-27 2:24 ` Martin K. Petersen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.