Skip to contentSkip to conversation

ucd9000.c: Drop error checking for debugfs_create_dir

PATCH In review Osama Muhammad 2 participants 3 messages May 25, 2023 1 message not in the archive Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ucd9000.c: Drop error checking for debugfs_create_dir

This patch fixes the error checking in ucd9000.c. The DebugFS kernel API is developed in
a way that the caller can safely ignore the errors that occur during the creation of DebugFS nodes.

---
 drivers/hwmon/pmbus/ucd9000.c | 2 --
 1 file changed, 2 deletions(-)
drivers/hwmon/pmbus/ucd9000.c +0 -2
index 3daaf2237832..73559afa8ba7 100644
@@ -512,8 +512,6 @@ static int ucd9000_init_debugfs(struct i2c_client *client,
 		return -ENOENT;
 
 	data->debugfs = debugfs_create_dir(client->name, debugfs);
-	if (!data->debugfs)
-		return -ENOENT;
 
 	/*
 	 * Of the chips this driver supports, only the UCD9090, UCD90160,
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 1 line · Osama Muhammad

This patch fixes the error checking in ucd9000.c.

Sure, but you should also explain what is wrong with the code (i.e., that debugfs_create_dir() does not return NULL but an ERR_PTR after an error).

Quoted 4 lines

The DebugFS kernel API is developed in
a way that the caller can safely ignore the errors that occur during the creation of DebugFS nodes.

If you plan t send more patches, please watch out for the subject line to match subject lines used in a subsystem. Here it should start with something like

hwmon: (pmbus/ucd9000) ...

Thanks,
Guenter

Quoted 21 lines
---
 drivers/hwmon/pmbus/ucd9000.c | 2 --
 1 file changed, 2 deletions(-)
drivers/hwmon/pmbus/ucd9000.c +0 -2
index 3daaf2237832..73559afa8ba7 100644
@@ -512,8 +512,6 @@ static int ucd9000_init_debugfs(struct i2c_client *client,
 		return -ENOENT;
 
 	data->debugfs = debugfs_create_dir(client->name, debugfs);
-	if (!data->debugfs)
-		return -ENOENT;
 
 	/*
 	 * Of the chips this driver supports, only the UCD9090, UCD90160,
Signature · 1 line
2.34.1

A message that is not in the archive (sent off-list or not yet received): CAK6rUAObC7_r1Riqfr7nd_B1BKx=abGXYk7F+5euGCiB2+xmWg@mail.gmail.com

maintainer
#3 lore raw
Quoted 11 lines · Osama Muhammad
Quoted 7 lines · Guenter Roeck
Quoted 1 line · Osama Muhammad

This patch fixes the error checking in ucd9000.c.

Sure, but you should also explain what is wrong with the code (i.e., that debugfs_create_dir() does not return NULL but an ERR_PTR after an error).

Should I send another version of the patch?

Please do.

Guenter

Quoted 46 lines
Quoted 7 lines
Quoted 6 lines

The DebugFS kernel API is developed in
a way that the caller can safely ignore the errors that occur during the creation of DebugFS nodes.

Quoted 7 lines

If you plan t send more patches, please watch out for the subject line to match subject lines used in a subsystem. Here it should start with something like

hwmon: (pmbus/ucd9000) ...

Thanks for the information and will keep it in mind while sending patches

afterwards.

Quoted 8 lines

Thanks,
Guenter

Quoted 5 lines
---
 drivers/hwmon/pmbus/ucd9000.c | 2 --
 1 file changed, 2 deletions(-)
Quoted 18 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/hwmon/pmbus/ucd9000.c

drivers/hwmon/pmbus/ucd9000.c static int ucd9000_init_debugfs(struct i2c_client

Quoted 4 lines

index 3daaf2237832..73559afa8ba7 100644

drivers/hwmon/pmbus/ucd9000.c +0 -0
@@ -512,8 +512,6 @@ static int ucd9000_init_debugfs(struct i2c_client

*client,

Quoted 11 lines
drivers/hwmon/pmbus/ucd9000.c +0 -3
              return -ENOENT;
 
      data->debugfs = debugfs_create_dir(client->name, debugfs);
-     if (!data->debugfs)
-             return -ENOENT;
 
      /*
       * Of the chips this driver supports, only the UCD9090, UCD90160,
--

2.34.1

Thanks,
Osmten