lkml.org 
[lkml]   [2023]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v5] iommu: Fix an error check in tegra_smmu_debugfs_init()
From
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

\
 
 \ /
  Last update: 2023-07-16 20:52    [W:0.154 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site