* [PATCH -next] ntb: amd: Drop unnecessary error check for debugfs_create_dir
@ 2023-08-17 6:32 Ruan Jinjie
2023-08-17 6:38 ` Sanjay R Mehta
0 siblings, 1 reply; 2+ messages in thread
From: Ruan Jinjie @ 2023-08-17 6:32 UTC (permalink / raw)
To: ntb, Sanjay R Mehta, Shyam Sundar S K, Jon Mason, Dave Jiang,
Allen Hubbe
Cc: ruanjinjie
This patch removes the error checking for debugfs_create_dir in
ntb_hw_amd.c. This is because the DebugFS kernel API is developed
in a way that the caller can safely ignore the errors that
occur during the creation of DebugFS nodes. The debugfs APIs have
a IS_ERR() judge in start_creating() which can handle it
gracefully. so these checks are unnecessary.
Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
---
drivers/ntb/hw/amd/ntb_hw_amd.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c
index 4940b6301d83..d687e8c2cc78 100644
--- a/drivers/ntb/hw/amd/ntb_hw_amd.c
+++ b/drivers/ntb/hw/amd/ntb_hw_amd.c
@@ -941,13 +941,10 @@ static void ndev_init_debugfs(struct amd_ntb_dev *ndev)
ndev->debugfs_dir =
debugfs_create_dir(pci_name(ndev->ntb.pdev),
debugfs_dir);
- if (IS_ERR(ndev->debugfs_dir))
- ndev->debugfs_info = NULL;
- else
- ndev->debugfs_info =
- debugfs_create_file("info", S_IRUSR,
- ndev->debugfs_dir, ndev,
- &amd_ntb_debugfs_info);
+ ndev->debugfs_info =
+ debugfs_create_file("info", S_IRUSR,
+ ndev->debugfs_dir, ndev,
+ &amd_ntb_debugfs_info);
}
}
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] ntb: amd: Drop unnecessary error check for debugfs_create_dir
2023-08-17 6:32 [PATCH -next] ntb: amd: Drop unnecessary error check for debugfs_create_dir Ruan Jinjie
@ 2023-08-17 6:38 ` Sanjay R Mehta
0 siblings, 0 replies; 2+ messages in thread
From: Sanjay R Mehta @ 2023-08-17 6:38 UTC (permalink / raw)
To: Ruan Jinjie, ntb, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
Dave Jiang, Allen Hubbe
On 8/17/2023 12:02 PM, Ruan Jinjie wrote:
> This patch removes the error checking for debugfs_create_dir in
> ntb_hw_amd.c. This is because the DebugFS kernel API is developed
> in a way that the caller can safely ignore the errors that
> occur during the creation of DebugFS nodes. The debugfs APIs have
> a IS_ERR() judge in start_creating() which can handle it
> gracefully. so these checks are unnecessary.
>
Acked-by: Sanjay R Mehta <sanju.mehta@amd.com>
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> ---
> drivers/ntb/hw/amd/ntb_hw_amd.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c
> index 4940b6301d83..d687e8c2cc78 100644
> --- a/drivers/ntb/hw/amd/ntb_hw_amd.c
> +++ b/drivers/ntb/hw/amd/ntb_hw_amd.c
> @@ -941,13 +941,10 @@ static void ndev_init_debugfs(struct amd_ntb_dev *ndev)
> ndev->debugfs_dir =
> debugfs_create_dir(pci_name(ndev->ntb.pdev),
> debugfs_dir);
> - if (IS_ERR(ndev->debugfs_dir))
> - ndev->debugfs_info = NULL;
> - else
> - ndev->debugfs_info =
> - debugfs_create_file("info", S_IRUSR,
> - ndev->debugfs_dir, ndev,
> - &amd_ntb_debugfs_info);
> + ndev->debugfs_info =
> + debugfs_create_file("info", S_IRUSR,
> + ndev->debugfs_dir, ndev,
> + &amd_ntb_debugfs_info);
> }
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-17 6:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-17 6:32 [PATCH -next] ntb: amd: Drop unnecessary error check for debugfs_create_dir Ruan Jinjie
2023-08-17 6:38 ` Sanjay R Mehta
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).