ntb.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] dtivers: ntb: fix parameter check in perf_setup_dbgfs()
@ 2023-07-13  3:47 Minjie Du
  2023-07-13 15:05 ` [PATCH] drivers: " Markus Elfring
  2023-08-13 14:48 ` [PATCH v1] dtivers: " Serge Semin
  0 siblings, 2 replies; 3+ messages in thread
From: Minjie Du @ 2023-07-13  3:47 UTC (permalink / raw)
  To: Jon Mason, Dave Jiang, Allen Hubbe, Minjie Du, Stephen Rothwell,
	open list:NTB DRIVER CORE, open list
  Cc: opensource.kernel

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

Signed-off-by: Minjie Du <duminjie@vivo.com>
---
 drivers/ntb/test/ntb_perf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c
index 65e1e5cf1..553f1f46b 100644
--- a/drivers/ntb/test/ntb_perf.c
+++ b/drivers/ntb/test/ntb_perf.c
@@ -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;
 	}
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drivers: ntb: fix parameter check in perf_setup_dbgfs()
  2023-07-13  3:47 [PATCH v1] dtivers: ntb: fix parameter check in perf_setup_dbgfs() Minjie Du
@ 2023-07-13 15:05 ` Markus Elfring
  2023-08-13 14:48 ` [PATCH v1] dtivers: " Serge Semin
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2023-07-13 15:05 UTC (permalink / raw)
  To: Minjie Du, opensource.kernel, ntb, kernel-janitors, Allen Hubbe,
	Dave Jiang, Jon Mason, Stephen Rothwell
  Cc: LKML

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] dtivers: ntb: fix parameter check in perf_setup_dbgfs()
  2023-07-13  3:47 [PATCH v1] dtivers: ntb: fix parameter check in perf_setup_dbgfs() Minjie Du
  2023-07-13 15:05 ` [PATCH] drivers: " Markus Elfring
@ 2023-08-13 14:48 ` Serge Semin
  1 sibling, 0 replies; 3+ messages in thread
From: Serge Semin @ 2023-08-13 14:48 UTC (permalink / raw)
  To: Minjie Du
  Cc: Jon Mason, Dave Jiang, Allen Hubbe, Stephen Rothwell,
	open list:NTB DRIVER CORE, open list, opensource.kernel

On Thu, Jul 13, 2023 at 11:47:27AM +0800, Minjie Du wrote:
> Make IS_ERR() judge the debugfs_create_dir() function return
> in perf_setup_dbgfs().

The patch itself is correct for sure:
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>

But as I already noted in a similar patch submitted for ntb_tool.c:
https://lore.kernel.org/ntb/5d0cd0e0-d92e-42d3-a6d9-ec9fc3229b7b@kadam.mountain/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)

> 
> Signed-off-by: Minjie Du <duminjie@vivo.com>
> ---
>  drivers/ntb/test/ntb_perf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c
> index 65e1e5cf1..553f1f46b 100644
> --- a/drivers/ntb/test/ntb_perf.c
> +++ b/drivers/ntb/test/ntb_perf.c
> @@ -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;
>  	}
> -- 
> 2.39.0
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-13 14:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-13  3:47 [PATCH v1] dtivers: ntb: fix parameter check in perf_setup_dbgfs() Minjie Du
2023-07-13 15:05 ` [PATCH] drivers: " Markus Elfring
2023-08-13 14:48 ` [PATCH v1] dtivers: " Serge Semin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).