diff mbox series

hwmon: asus_atk0110: no need to check return value of debugfs_create functions

Message ID 20190611175858.GA10077@kroah.com (mailing list archive)
State Accepted
Headers show
Series hwmon: asus_atk0110: no need to check return value of debugfs_create functions | expand

Commit Message

Greg Kroah-Hartman June 11, 2019, 5:58 p.m. UTC
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Luca Tettamanti <kronos.it@gmail.com>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hwmon/asus_atk0110.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

Comments

Guenter Roeck June 12, 2019, 12:38 p.m. UTC | #1
On Tue, Jun 11, 2019 at 07:58:58PM +0200, Greg Kroah-Hartman wrote:
> When calling debugfs functions, there is no need to ever check the
> return value.  The function can work or not, but the code logic should
> never do something different based on this.
> 
> Cc: Luca Tettamanti <kronos.it@gmail.com>
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: linux-hwmon@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/asus_atk0110.c | 23 +++--------------------
>  1 file changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c
> index 22be78cc5a4c..b5f0abde916b 100644
> --- a/drivers/hwmon/asus_atk0110.c
> +++ b/drivers/hwmon/asus_atk0110.c
> @@ -789,33 +789,16 @@ static const struct file_operations atk_debugfs_ggrp_fops = {
>  static void atk_debugfs_init(struct atk_data *data)
>  {
>  	struct dentry *d;
> -	struct dentry *f;
>  
>  	data->debugfs.id = 0;
>  
>  	d = debugfs_create_dir("asus_atk0110", NULL);
> -	if (!d || IS_ERR(d))
> -		return;
>  
> -	f = debugfs_create_x32("id", 0600, d, &data->debugfs.id);
> -	if (!f || IS_ERR(f))
> -		goto cleanup;
> -
> -	f = debugfs_create_file_unsafe("gitm", 0400, d, data,
> -				       &atk_debugfs_gitm);
> -	if (!f || IS_ERR(f))
> -		goto cleanup;
> -
> -	f = debugfs_create_file("ggrp", 0400, d, data,
> -				&atk_debugfs_ggrp_fops);
> -	if (!f || IS_ERR(f))
> -		goto cleanup;
> +	debugfs_create_x32("id", 0600, d, &data->debugfs.id);
> +	debugfs_create_file_unsafe("gitm", 0400, d, data, &atk_debugfs_gitm);
> +	debugfs_create_file("ggrp", 0400, d, data, &atk_debugfs_ggrp_fops);
>  
>  	data->debugfs.root = d;
> -
> -	return;
> -cleanup:
> -	debugfs_remove_recursive(d);
>  }
>  
>  static void atk_debugfs_cleanup(struct atk_data *data)
diff mbox series

Patch

diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c
index 22be78cc5a4c..b5f0abde916b 100644
--- a/drivers/hwmon/asus_atk0110.c
+++ b/drivers/hwmon/asus_atk0110.c
@@ -789,33 +789,16 @@  static const struct file_operations atk_debugfs_ggrp_fops = {
 static void atk_debugfs_init(struct atk_data *data)
 {
 	struct dentry *d;
-	struct dentry *f;
 
 	data->debugfs.id = 0;
 
 	d = debugfs_create_dir("asus_atk0110", NULL);
-	if (!d || IS_ERR(d))
-		return;
 
-	f = debugfs_create_x32("id", 0600, d, &data->debugfs.id);
-	if (!f || IS_ERR(f))
-		goto cleanup;
-
-	f = debugfs_create_file_unsafe("gitm", 0400, d, data,
-				       &atk_debugfs_gitm);
-	if (!f || IS_ERR(f))
-		goto cleanup;
-
-	f = debugfs_create_file("ggrp", 0400, d, data,
-				&atk_debugfs_ggrp_fops);
-	if (!f || IS_ERR(f))
-		goto cleanup;
+	debugfs_create_x32("id", 0600, d, &data->debugfs.id);
+	debugfs_create_file_unsafe("gitm", 0400, d, data, &atk_debugfs_gitm);
+	debugfs_create_file("ggrp", 0400, d, data, &atk_debugfs_ggrp_fops);
 
 	data->debugfs.root = d;
-
-	return;
-cleanup:
-	debugfs_remove_recursive(d);
 }
 
 static void atk_debugfs_cleanup(struct atk_data *data)