Smatch complains that:
rdev_init_debugfs() warn: 'rdev->debugfs' is an error pointer or valid
According to the documentation of the debugfs_create_dir() function,
there is no need to check the return value of this function.
Just delete the dead code.
Fixes: 247514344492 ("regulator: Remove ifdefs for debugfs code")
Fixes: 1130e5b3ff4a ("regulator: Add initial per-regulator debugfs support")
Signed-off-by: Yuchen Yang <[email protected]>
Reviewed-by: Dongliang Mu <[email protected]>
---
drivers/regulator/core.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 4fcd36055b02..979ee043f7a1 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -5188,10 +5188,6 @@ static void rdev_init_debugfs(struct regulator_dev *rdev)
}
rdev->debugfs = debugfs_create_dir(rname, debugfs_root);
- if (!rdev->debugfs) {
- rdev_warn(rdev, "Failed to create debugfs directory\n");
- return;
- }
debugfs_create_u32("use_count", 0444, rdev->debugfs,
&rdev->use_count);
--
2.25.1
On Mon, Apr 24, 2023 at 10:57:37AM +0800, Yuchen Yang wrote:
> Smatch complains that:
> rdev_init_debugfs() warn: 'rdev->debugfs' is an error pointer or valid
>
> According to the documentation of the debugfs_create_dir() function,
> there is no need to check the return value of this function.
> Just delete the dead code.
Please stop sending these patches.
On 2023/4/24 19:56, Mark Brown wrote:
> On Mon, Apr 24, 2023 at 10:57:37AM +0800, Yuchen Yang wrote:
>> Smatch complains that:
>> rdev_init_debugfs() warn: 'rdev->debugfs' is an error pointer or valid
>>
>> According to the documentation of the debugfs_create_dir() function,
>> there is no need to check the return value of this function.
>> Just delete the dead code.
> Please stop sending these patches.
No problem. We will disable this Smatch checker in our daily use.
Thanks for your feedback.