Skip to contentSkip to conversation

dtivers: ntb: fix parameter check in perf_setup_dbgfs()

PATCH In review Minjie Du 3 participants 3 messages Jul 13, 2023 – Aug 13, 2023 NTB driver core

lore
Share & tools
lore

Minjie Du

author
#0 lore raw

PATCH 1/1 dtivers: ntb: fix parameter check in perf_setup_dbgfs()

Make IS_ERR() judge the debugfs_create_dir() function return in perf_setup_dbgfs().

---
 drivers/ntb/test/ntb_perf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/test/ntb_perf.c +1 -1
index 65e1e5cf1..553f1f46b 100644
@@ -1355,7 +1355,7 @@ static void perf_setup_dbgfs(struct perf_ctx *perf)
 	struct pci_dev *pdev = perf->ntb->pdev;
 
 	perf->dbgfs_dir = debugfs_create_dir(pci_name(pdev), perf_dbgfs_topdir);
-	if (!perf->dbgfs_dir) {
+	if (IS_ERR(perf->dbgfs_dir)) {
 		dev_warn(&perf->ntb->dev, "DebugFS unsupported\n");
 		return;
 	}
Signature · 1 line
2.39.0
#1 lore raw

Re: [PATCH] drivers: ntb: fix parameter check in perf_setup_dbgfs()

Quoted 1 line

Make IS_ERR() judge the debugfs_create_dir() function return

Would the term “return value” be relevant here?

Would you like to improve this change description also according to review comments from other patches?

How do you think about to add the tag “Fixes” because of a corrected error detection?

Would a subject like “[PATCH v2] NTB: perf: Fix an error check in perf_setup_dbgfs() be more appropriate?

Regards,
Markus

Reviewed-by on v1 1/1
#2 lore raw
In reply to Minjie Du
Quoted 2 lines · Minjie Du

Make IS_ERR() judge the debugfs_create_dir() function return in perf_setup_dbgfs().

The patch itself is correct for sure:

But as I already noted in a similar patch submitted for ntb_tool.c:
https://lore.kernel.org/ntb/[email protected]/T/#m78d5823691d2f205d43aaa9e09028674d57296ab

Neither NTB perf, nor NTB tool, nor NTB pong-ping (nor likely NTB MSI test) drivers make any sense without DebugFS because their functionality has been developed based on the DebugFS nodes. The better change would be to just fail the NTB devices probing in these drivers if DebugFS is unsupported.

-Serge(y)

Quoted 23 lines
---
 drivers/ntb/test/ntb_perf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/test/ntb_perf.c +1 -1
index 65e1e5cf1..553f1f46b 100644
@@ -1355,7 +1355,7 @@ static void perf_setup_dbgfs(struct perf_ctx *perf)
 	struct pci_dev *pdev = perf->ntb->pdev;
 
 	perf->dbgfs_dir = debugfs_create_dir(pci_name(pdev), perf_dbgfs_topdir);
-	if (!perf->dbgfs_dir) {
+	if (IS_ERR(perf->dbgfs_dir)) {
 		dev_warn(&perf->ntb->dev, "DebugFS unsupported\n");
 		return;
 	}
Signature · 1 line
2.39.0