2023-07-13 09:27:21

by Wang Ming

[permalink] [raw]
Subject: [PATCH v3] ntb: Remove error checking for debugfs_create_dir()

It is expected that most callers should _ignore_ the errors
return by debugfs_create_dir() in tool_setup_dbgfs()

Signed-off-by: Wang Ming <[email protected]>
---
drivers/ntb/test/ntb_tool.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/ntb/test/ntb_tool.c b/drivers/ntb/test/ntb_tool.c
index eeeb4b1c97d2..e0acc11d29ba 100644
--- a/drivers/ntb/test/ntb_tool.c
+++ b/drivers/ntb/test/ntb_tool.c
@@ -1495,8 +1495,6 @@ static void tool_setup_dbgfs(struct tool_ctx *tc)

tc->dbgfs_dir = debugfs_create_dir(dev_name(&tc->ntb->dev),
tool_dbgfs_topdir);
- if (!tc->dbgfs_dir)
- return;

debugfs_create_file("port", 0600, tc->dbgfs_dir,
tc, &tool_port_fops);
--
2.25.1



2023-07-13 09:55:49

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v3] ntb: Remove error checking for debugfs_create_dir()

On Thu, Jul 13, 2023 at 04:56:06PM +0800, Wang Ming wrote:
> It is expected that most callers should _ignore_ the errors
> return by debugfs_create_dir() in tool_setup_dbgfs()
>
> Signed-off-by: Wang Ming <[email protected]>

Reviewed-by: Dan Carpenter <[email protected]>

regards,
dan carpenter


2023-07-13 16:36:33

by Dave Jiang

[permalink] [raw]
Subject: Re: [PATCH v3] ntb: Remove error checking for debugfs_create_dir()



On 7/13/23 01:56, Wang Ming wrote:
> It is expected that most callers should _ignore_ the errors
> return by debugfs_create_dir() in tool_setup_dbgfs()
>
> Signed-off-by: Wang Ming <[email protected]>

Reviewed-by: Dave Jiang <[email protected]>
> ---
> drivers/ntb/test/ntb_tool.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/ntb/test/ntb_tool.c b/drivers/ntb/test/ntb_tool.c
> index eeeb4b1c97d2..e0acc11d29ba 100644
> --- a/drivers/ntb/test/ntb_tool.c
> +++ b/drivers/ntb/test/ntb_tool.c
> @@ -1495,8 +1495,6 @@ static void tool_setup_dbgfs(struct tool_ctx *tc)
>
> tc->dbgfs_dir = debugfs_create_dir(dev_name(&tc->ntb->dev),
> tool_dbgfs_topdir);
> - if (!tc->dbgfs_dir)
> - return;
>
> debugfs_create_file("port", 0600, tc->dbgfs_dir,
> tc, &tool_port_fops);

2023-07-14 10:11:18

by Serge Semin

[permalink] [raw]
Subject: Re: [PATCH v3] ntb: Remove error checking for debugfs_create_dir()

On Thu, Jul 13, 2023 at 04:56:06PM +0800, Wang Ming wrote:
> It is expected that most callers should _ignore_ the errors
> return by debugfs_create_dir() in tool_setup_dbgfs()
>
> Signed-off-by: Wang Ming <[email protected]>

The patch itself is correct for sure:
Reviewed-by: Serge Semin <[email protected]>

As a side note IMO I would have converted the driver to successfully
probe an NTB device only if DebugFS is enabled and all the DebugFS-nodes
are successfully created. That's because the driver fully relies on
the DebugFS nodes to activate its functionality. Without them being
available it's absolutely useless. The way the test-driver is utilized
is demonstrated for instance in the NTB-test script:
tools/testing/selftests/ntb/ntb_test.sh .

* It concerns all the NTB test drivers...

-Serge(y)

> ---
> drivers/ntb/test/ntb_tool.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/ntb/test/ntb_tool.c b/drivers/ntb/test/ntb_tool.c
> index eeeb4b1c97d2..e0acc11d29ba 100644
> --- a/drivers/ntb/test/ntb_tool.c
> +++ b/drivers/ntb/test/ntb_tool.c
> @@ -1495,8 +1495,6 @@ static void tool_setup_dbgfs(struct tool_ctx *tc)
>
> tc->dbgfs_dir = debugfs_create_dir(dev_name(&tc->ntb->dev),
> tool_dbgfs_topdir);
> - if (!tc->dbgfs_dir)
> - return;
>
> debugfs_create_file("port", 0600, tc->dbgfs_dir,
> tc, &tool_port_fops);
> --
> 2.25.1
>