* [PATCH v5] iommu: Fix an error check in tegra_smmu_debugfs_init()
@ 2023-07-14 8:13 Minjie Du
2023-07-15 6:26 ` Baolu Lu
0 siblings, 1 reply; 2+ messages in thread
From: Minjie Du @ 2023-07-14 8:13 UTC (permalink / raw)
To: Thierry Reding, Krishna Reddy, Joerg Roedel, Will Deacon,
Robin Murphy, Jonathan Hunter, open list:TEGRA IOMMU DRIVERS,
open list:IOMMU SUBSYSTEM, open list
Cc: opensource.kernel, Minjie Du
debugfs_create_dir() function returns an error value(PTR_ERR).
We need to evaluate the return value using IS_ERR,
rather than checking for NULL.
Fixes: d1313e7896e9 ("iommu/tegra-smmu: Add debugfs support")
Signed-off-by: Minjie Du <duminjie@vivo.com>
---
V4 -> V5: debugfs needs to have error checking, so use IS_ERR() to error check.
V3 -> V4: fix expression about patch.
V2 -> V3: fix expression about patch.
V1 -> V2: remove the error check.
V1: use IS_ERR() to error check.
---
drivers/iommu/tegra-smmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index 1cbf063cc..841e14cce 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -1056,7 +1056,7 @@ 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)
+ if (IS_ERR(smmu->debugfs))
return;
debugfs_create_file("swgroups", S_IRUGO, smmu->debugfs, smmu,
--
2.39.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v5] iommu: Fix an error check in tegra_smmu_debugfs_init()
2023-07-14 8:13 [PATCH v5] iommu: Fix an error check in tegra_smmu_debugfs_init() Minjie Du
@ 2023-07-15 6:26 ` Baolu Lu
0 siblings, 0 replies; 2+ messages in thread
From: Baolu Lu @ 2023-07-15 6:26 UTC (permalink / raw)
To: Minjie Du, Thierry Reding, Krishna Reddy, Joerg Roedel,
Will Deacon, Robin Murphy, Jonathan Hunter,
open list:TEGRA IOMMU DRIVERS, open list:IOMMU SUBSYSTEM,
open list
Cc: baolu.lu, opensource.kernel
On 7/14/23 4:13 PM, Minjie Du wrote:
> debugfs_create_dir() function returns an error value(PTR_ERR).
> We need to evaluate the return value using IS_ERR,
> rather than checking for NULL.
>
> Fixes: d1313e7896e9 ("iommu/tegra-smmu: Add debugfs support")
> Signed-off-by: Minjie Du<duminjie@vivo.com>
> ---
> V4 -> V5: debugfs needs to have error checking, so use IS_ERR() to error check.
Why?
[...]
* NOTE: it's expected that most callers should _ignore_ the errors
returned
* by this function. Other debugfs functions handle the fact that the
"dentry"
* passed to them could be an error and they don't crash in that case.
* Drivers should generally work fine even if debugfs fails to init anyway.
*/
struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
{
struct dentry *dentry = start_creating(name, parent);
struct inode *inode;
if (IS_ERR(dentry))
return dentry;
[...]
Best regards,
baolu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-15 6:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-14 8:13 [PATCH v5] iommu: Fix an error check in tegra_smmu_debugfs_init() Minjie Du
2023-07-15 6:26 ` Baolu Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®