[PATCH] drivers: regulator: core: remove return value check of `rdev->debugfs`

Yuchen Yang posted 1 patch 2 years, 7 months ago
drivers/regulator/core.c | 4 ----
1 file changed, 4 deletions(-)
[PATCH] drivers: regulator: core: remove return value check of `rdev->debugfs`
Posted by Yuchen Yang 2 years, 7 months ago
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 <u202114568@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
---
 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
Re: [PATCH] drivers: regulator: core: remove return value check of `rdev->debugfs`
Posted by Mark Brown 2 years, 7 months ago
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.
Re: [PATCH] drivers: regulator: core: remove return value check of `rdev->debugfs`
Posted by Dongliang Mu 2 years, 7 months ago
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.