Linux-PM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] thermal: intel: no need to check return value of debugfs_create functions
@ 2019-06-13 18:38 Greg Kroah-Hartman
  2019-06-14 10:08 ` Daniel Lezcano
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-13 18:38 UTC (permalink / raw)
  To: Zhang Rui, Eduardo Valentin, Daniel Lezcano; +Cc: linux-pm

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: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/thermal/intel/x86_pkg_temp_thermal.c | 25 ++++----------------
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/drivers/thermal/intel/x86_pkg_temp_thermal.c b/drivers/thermal/intel/x86_pkg_temp_thermal.c
index 1ef937d799e4..f0441ac25555 100644
--- a/drivers/thermal/intel/x86_pkg_temp_thermal.c
+++ b/drivers/thermal/intel/x86_pkg_temp_thermal.c
@@ -87,29 +87,14 @@ static struct dentry *debugfs;
 static unsigned int pkg_interrupt_cnt;
 static unsigned int pkg_work_cnt;
 
-static int pkg_temp_debugfs_init(void)
+static void pkg_temp_debugfs_init(void)
 {
-	struct dentry *d;
-
 	debugfs = debugfs_create_dir("pkg_temp_thermal", NULL);
-	if (!debugfs)
-		return -ENOENT;
-
-	d = debugfs_create_u32("pkg_thres_interrupt", S_IRUGO, debugfs,
-			       &pkg_interrupt_cnt);
-	if (!d)
-		goto err_out;
-
-	d = debugfs_create_u32("pkg_thres_work", S_IRUGO, debugfs,
-			       &pkg_work_cnt);
-	if (!d)
-		goto err_out;
 
-	return 0;
-
-err_out:
-	debugfs_remove_recursive(debugfs);
-	return -ENOENT;
+	debugfs_create_u32("pkg_thres_interrupt", S_IRUGO, debugfs,
+			   &pkg_interrupt_cnt);
+	debugfs_create_u32("pkg_thres_work", S_IRUGO, debugfs,
+			   &pkg_work_cnt);
 }
 
 /*
-- 
2.22.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] thermal: intel: no need to check return value of debugfs_create functions
  2019-06-13 18:38 [PATCH] thermal: intel: no need to check return value of debugfs_create functions Greg Kroah-Hartman
@ 2019-06-14 10:08 ` Daniel Lezcano
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Lezcano @ 2019-06-14 10:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Zhang Rui, Eduardo Valentin; +Cc: linux-pm

On 13/06/2019 20:38, 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: Zhang Rui <rui.zhang@intel.com>
> Cc: Eduardo Valentin <edubezval@gmail.com>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: linux-pm@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

> ---
>  drivers/thermal/intel/x86_pkg_temp_thermal.c | 25 ++++----------------
>  1 file changed, 5 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/thermal/intel/x86_pkg_temp_thermal.c b/drivers/thermal/intel/x86_pkg_temp_thermal.c
> index 1ef937d799e4..f0441ac25555 100644
> --- a/drivers/thermal/intel/x86_pkg_temp_thermal.c
> +++ b/drivers/thermal/intel/x86_pkg_temp_thermal.c
> @@ -87,29 +87,14 @@ static struct dentry *debugfs;
>  static unsigned int pkg_interrupt_cnt;
>  static unsigned int pkg_work_cnt;
>  
> -static int pkg_temp_debugfs_init(void)
> +static void pkg_temp_debugfs_init(void)
>  {
> -	struct dentry *d;
> -
>  	debugfs = debugfs_create_dir("pkg_temp_thermal", NULL);
> -	if (!debugfs)
> -		return -ENOENT;
> -
> -	d = debugfs_create_u32("pkg_thres_interrupt", S_IRUGO, debugfs,
> -			       &pkg_interrupt_cnt);
> -	if (!d)
> -		goto err_out;
> -
> -	d = debugfs_create_u32("pkg_thres_work", S_IRUGO, debugfs,
> -			       &pkg_work_cnt);
> -	if (!d)
> -		goto err_out;
>  
> -	return 0;
> -
> -err_out:
> -	debugfs_remove_recursive(debugfs);
> -	return -ENOENT;
> +	debugfs_create_u32("pkg_thres_interrupt", S_IRUGO, debugfs,
> +			   &pkg_interrupt_cnt);
> +	debugfs_create_u32("pkg_thres_work", S_IRUGO, debugfs,
> +			   &pkg_work_cnt);
>  }
>  
>  /*
> 


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-13 18:38 [PATCH] thermal: intel: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-06-14 10:08 ` Daniel Lezcano

Linux-PM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pm/0 linux-pm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pm linux-pm/ https://lore.kernel.org/linux-pm \
		linux-pm@vger.kernel.org linux-pm@archiver.kernel.org
	public-inbox-index linux-pm


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pm


AGPL code for this site: git clone https://public-inbox.org/ public-inbox