Skip to contentSkip to conversation

hwmon: (pmbus/max20730) delete some dead code

PATCH Applied Dan Carpenter 2 participants 2 messages Oct 22, 2020 – Oct 23, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (pmbus/max20730) delete some dead code

The debugfs_create_dir() function never returns NULL. Normal users are not supposed to check the return value so the correct fix is just to delete this check.

In the case where the debugfs_create_dir() fails, the function returns NULL. The other debugfs function check for NULL directory and handle it.

---
 drivers/hwmon/pmbus/max20730.c | 2 --
 1 file changed, 2 deletions(-)
drivers/hwmon/pmbus/max20730.c +0 -2
index be83b98411c7..00fea16acab4 100644
@@ -328,8 +328,6 @@ static int max20730_init_debugfs(struct i2c_client *client,
 		return -ENOENT;
 
 	max20730_dir = debugfs_create_dir(client->name, debugfs);
-	if (!max20730_dir)
-		return -ENOENT;
 
 	for (i = 0; i < MAX20730_DEBUGFS_NUM_ENTRIES; ++i)
 		psu->debugfs_entries[i] = i;
Signature · 1 line
2.28.0
maintainer Applied
#1 lore raw
Quoted 9 lines · Dan Carpenter

The debugfs_create_dir() function never returns NULL. Normal users are not supposed to check the return value so the correct fix is just to delete this check.

In the case where the debugfs_create_dir() fails, the function returns NULL. The other debugfs function check for NULL directory and handle it.

Applied.

Thanks,
Guenter

Quoted 17 lines
---
 drivers/hwmon/pmbus/max20730.c | 2 --
 1 file changed, 2 deletions(-)
drivers/hwmon/pmbus/max20730.c +0 -2
index be83b98411c7..00fea16acab4 100644
@@ -328,8 +328,6 @@ static int max20730_init_debugfs(struct i2c_client *client,
 		return -ENOENT;
 
 	max20730_dir = debugfs_create_dir(client->name, debugfs);
-	if (!max20730_dir)
-		return -ENOENT;
 
 	for (i = 0; i < MAX20730_DEBUGFS_NUM_ENTRIES; ++i)
 		psu->debugfs_entries[i] = i;