Re: [PATCH] net: mvpp2: Fix error checking
From: Simon Horman
Date: Wed May 17 2023 - 16:15:06 EST
On Thu, May 18, 2023 at 03:08:11AM +0800, Yeqi Fu wrote:
> The function debugfs_create_dir returns ERR_PTR if an error occurs,
> and the appropriate way to verify for errors is to use the inline
> function IS_ERR. The patch will substitute the null-comparison with
> IS_ERR.
The comment above debugfs_create_dir includes the following text.
* 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.
And I notice that in this same file there are calls to debugfs_create_dir()
where that advice is followed: the return value is ignored.
So I think the correct approach here is to simply remove the error
checking.
And, to answer my own question while reviewing this. I don't think
Fixes tags are warranted, as debugfs_create_dir() is not expected
to return errors, so there shouldn't be a but in practice. At least
that is my reasoning.
--
pw-bot: cr