* [PATCH] hwmon: (pmbus/max20730) delete some dead code
@ 2020-10-22 7:06 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-10-22 7:06 UTC (permalink / raw)
To: Guenter Roeck, Ugur Usug; +Cc: Jean Delvare, linux-hwmon, kernel-janitors
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.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/hwmon/pmbus/max20730.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/hwmon/pmbus/max20730.c b/drivers/hwmon/pmbus/max20730.c
index be83b98411c7..00fea16acab4 100644
--- a/drivers/hwmon/pmbus/max20730.c
+++ b/drivers/hwmon/pmbus/max20730.c
@@ -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;
--
2.28.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] hwmon: (pmbus/max20730) delete some dead code
@ 2020-10-22 7:06 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-10-22 7:06 UTC (permalink / raw)
To: Guenter Roeck, Ugur Usug; +Cc: Jean Delvare, linux-hwmon, kernel-janitors
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.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/hwmon/pmbus/max20730.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/hwmon/pmbus/max20730.c b/drivers/hwmon/pmbus/max20730.c
index be83b98411c7..00fea16acab4 100644
--- a/drivers/hwmon/pmbus/max20730.c
+++ b/drivers/hwmon/pmbus/max20730.c
@@ -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;
--
2.28.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] hwmon: (pmbus/max20730) delete some dead code
2020-10-22 7:06 ` Dan Carpenter
@ 2020-10-23 21:14 ` Guenter Roeck
-1 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2020-10-23 21:14 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Ugur Usug, Jean Delvare, linux-hwmon, kernel-janitors
On Thu, Oct 22, 2020 at 10:06:59AM +0300, Dan Carpenter wrote:
> 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.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/pmbus/max20730.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/hwmon/pmbus/max20730.c b/drivers/hwmon/pmbus/max20730.c
> index be83b98411c7..00fea16acab4 100644
> --- a/drivers/hwmon/pmbus/max20730.c
> +++ b/drivers/hwmon/pmbus/max20730.c
> @@ -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;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hwmon: (pmbus/max20730) delete some dead code
@ 2020-10-23 21:14 ` Guenter Roeck
0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2020-10-23 21:14 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Ugur Usug, Jean Delvare, linux-hwmon, kernel-janitors
On Thu, Oct 22, 2020 at 10:06:59AM +0300, Dan Carpenter wrote:
> 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.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/pmbus/max20730.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/hwmon/pmbus/max20730.c b/drivers/hwmon/pmbus/max20730.c
> index be83b98411c7..00fea16acab4 100644
> --- a/drivers/hwmon/pmbus/max20730.c
> +++ b/drivers/hwmon/pmbus/max20730.c
> @@ -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;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-23 21:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-22 7:06 [PATCH] hwmon: (pmbus/max20730) delete some dead code Dan Carpenter
2020-10-22 7:06 ` Dan Carpenter
2020-10-23 21:14 ` Guenter Roeck
2020-10-23 21:14 ` Guenter Roeck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.