* [PATCH v2] iommu/tegra-smmu: Drop unnecessary error check for for debugfs_create_dir()
@ 2023-09-01 7:30 Jinjie Ruan
2023-09-06 13:44 ` Jason Gunthorpe
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jinjie Ruan @ 2023-09-01 7:30 UTC (permalink / raw)
To: linux-tegra, iommu, baolu.lu, Thierry Reding, Krishna Reddy,
Joerg Roedel, Will Deacon, Robin Murphy, Jonathan Hunter
Cc: ruanjinjie
The debugfs_create_dir() function returns error pointers.
It never returns NULL.
As Baolu suggested, this patch removes the error checking for
debugfs_create_dir in tegra-smmu.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.
Fixes: d1313e7896e9 ("iommu/tegra-smmu: Add debugfs support")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Suggested-by: Baolu Lu <baolu.lu@linux.intel.com>
---
v2:
- Remove the err check instead of using IS_ERR to replace NULL check.
- Update the commit message and title.
---
drivers/iommu/tegra-smmu.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index 1cbf063ccf14..2137040b7efa 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -1056,8 +1056,6 @@ DEFINE_SHOW_ATTRIBUTE(tegra_smmu_clients);
static void tegra_smmu_debugfs_init(struct tegra_smmu *smmu)
{
smmu->debugfs = debugfs_create_dir("smmu", NULL);
- if (!smmu->debugfs)
- return;
debugfs_create_file("swgroups", S_IRUGO, smmu->debugfs, smmu,
&tegra_smmu_swgroups_fops);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] iommu/tegra-smmu: Drop unnecessary error check for for debugfs_create_dir()
2023-09-01 7:30 [PATCH v2] iommu/tegra-smmu: Drop unnecessary error check for for debugfs_create_dir() Jinjie Ruan
@ 2023-09-06 13:44 ` Jason Gunthorpe
2023-09-07 7:44 ` Thierry Reding
2023-09-25 10:42 ` Joerg Roedel
2 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2023-09-06 13:44 UTC (permalink / raw)
To: Jinjie Ruan
Cc: linux-tegra, iommu, baolu.lu, Thierry Reding, Krishna Reddy,
Joerg Roedel, Will Deacon, Robin Murphy, Jonathan Hunter
On Fri, Sep 01, 2023 at 03:30:56PM +0800, Jinjie Ruan wrote:
> The debugfs_create_dir() function returns error pointers.
> It never returns NULL.
>
> As Baolu suggested, this patch removes the error checking for
> debugfs_create_dir in tegra-smmu.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.
>
> Fixes: d1313e7896e9 ("iommu/tegra-smmu: Add debugfs support")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> Suggested-by: Baolu Lu <baolu.lu@linux.intel.com>
> ---
> v2:
> - Remove the err check instead of using IS_ERR to replace NULL check.
> - Update the commit message and title.
> ---
> drivers/iommu/tegra-smmu.c | 2 --
> 1 file changed, 2 deletions(-)
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] iommu/tegra-smmu: Drop unnecessary error check for for debugfs_create_dir()
2023-09-01 7:30 [PATCH v2] iommu/tegra-smmu: Drop unnecessary error check for for debugfs_create_dir() Jinjie Ruan
2023-09-06 13:44 ` Jason Gunthorpe
@ 2023-09-07 7:44 ` Thierry Reding
2023-09-25 10:42 ` Joerg Roedel
2 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2023-09-07 7:44 UTC (permalink / raw)
To: Jinjie Ruan
Cc: linux-tegra, iommu, baolu.lu, Krishna Reddy, Joerg Roedel,
Will Deacon, Robin Murphy, Jonathan Hunter
[-- Attachment #1: Type: text/plain, Size: 982 bytes --]
On Fri, Sep 01, 2023 at 03:30:56PM +0800, Jinjie Ruan wrote:
> The debugfs_create_dir() function returns error pointers.
> It never returns NULL.
>
> As Baolu suggested, this patch removes the error checking for
> debugfs_create_dir in tegra-smmu.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.
>
> Fixes: d1313e7896e9 ("iommu/tegra-smmu: Add debugfs support")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> Suggested-by: Baolu Lu <baolu.lu@linux.intel.com>
> ---
> v2:
> - Remove the err check instead of using IS_ERR to replace NULL check.
> - Update the commit message and title.
> ---
> drivers/iommu/tegra-smmu.c | 2 --
> 1 file changed, 2 deletions(-)
Acked-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] iommu/tegra-smmu: Drop unnecessary error check for for debugfs_create_dir()
2023-09-01 7:30 [PATCH v2] iommu/tegra-smmu: Drop unnecessary error check for for debugfs_create_dir() Jinjie Ruan
2023-09-06 13:44 ` Jason Gunthorpe
2023-09-07 7:44 ` Thierry Reding
@ 2023-09-25 10:42 ` Joerg Roedel
2 siblings, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2023-09-25 10:42 UTC (permalink / raw)
To: Jinjie Ruan
Cc: linux-tegra, iommu, baolu.lu, Thierry Reding, Krishna Reddy,
Will Deacon, Robin Murphy, Jonathan Hunter
On Fri, Sep 01, 2023 at 03:30:56PM +0800, Jinjie Ruan wrote:
> drivers/iommu/tegra-smmu.c | 2 --
> 1 file changed, 2 deletions(-)
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-09-25 10:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-01 7:30 [PATCH v2] iommu/tegra-smmu: Drop unnecessary error check for for debugfs_create_dir() Jinjie Ruan
2023-09-06 13:44 ` Jason Gunthorpe
2023-09-07 7:44 ` Thierry Reding
2023-09-25 10:42 ` Joerg Roedel
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).