All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] power: qos: no need to check return value of debugfs_create functions
@ 2019-01-22 15:21 Greg Kroah-Hartman
  2019-01-22 15:30 ` Rafael J. Wysocki
  2019-01-24 10:42 ` Rafael J. Wysocki
  0 siblings, 2 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 15:21 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Len Brown, Pavel Machek, 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: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <len.brown@intel.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/power/qos.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/kernel/power/qos.c b/kernel/power/qos.c
index b7a82502857a..9d22131afc1e 100644
--- a/kernel/power/qos.c
+++ b/kernel/power/qos.c
@@ -582,10 +582,8 @@ static int register_pm_qos_misc(struct pm_qos_object *qos, struct dentry *d)
 	qos->pm_qos_power_miscdev.name = qos->name;
 	qos->pm_qos_power_miscdev.fops = &pm_qos_power_fops;
 
-	if (d) {
-		(void)debugfs_create_file(qos->name, S_IRUGO, d,
-					  (void *)qos, &pm_qos_debug_fops);
-	}
+	debugfs_create_file(qos->name, S_IRUGO, d, (void *)qos,
+			    &pm_qos_debug_fops);
 
 	return misc_register(&qos->pm_qos_power_miscdev);
 }
@@ -685,8 +683,6 @@ static int __init pm_qos_power_init(void)
 	BUILD_BUG_ON(ARRAY_SIZE(pm_qos_array) != PM_QOS_NUM_CLASSES);
 
 	d = debugfs_create_dir("pm_qos", NULL);
-	if (IS_ERR_OR_NULL(d))
-		d = NULL;
 
 	for (i = PM_QOS_CPU_DMA_LATENCY; i < PM_QOS_NUM_CLASSES; i++) {
 		ret = register_pm_qos_misc(pm_qos_array[i], d);
-- 
2.20.1


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

* Re: [PATCH] power: qos: no need to check return value of debugfs_create functions
  2019-01-22 15:21 [PATCH] power: qos: no need to check return value of debugfs_create functions Greg Kroah-Hartman
@ 2019-01-22 15:30 ` Rafael J. Wysocki
  2019-01-22 15:53   ` Greg Kroah-Hartman
  2019-01-24 10:42 ` Rafael J. Wysocki
  1 sibling, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2019-01-22 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Linux Kernel Mailing List, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Linux PM

On Tue, Jan 22, 2019 at 4:25 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> 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: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Len Brown <len.brown@intel.com>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: linux-pm@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

All of these changes are fine by me and I can take the patches
touching the code maintained by me, so please let me know.

> ---
>  kernel/power/qos.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/power/qos.c b/kernel/power/qos.c
> index b7a82502857a..9d22131afc1e 100644
> --- a/kernel/power/qos.c
> +++ b/kernel/power/qos.c
> @@ -582,10 +582,8 @@ static int register_pm_qos_misc(struct pm_qos_object *qos, struct dentry *d)
>         qos->pm_qos_power_miscdev.name = qos->name;
>         qos->pm_qos_power_miscdev.fops = &pm_qos_power_fops;
>
> -       if (d) {
> -               (void)debugfs_create_file(qos->name, S_IRUGO, d,
> -                                         (void *)qos, &pm_qos_debug_fops);
> -       }
> +       debugfs_create_file(qos->name, S_IRUGO, d, (void *)qos,
> +                           &pm_qos_debug_fops);
>
>         return misc_register(&qos->pm_qos_power_miscdev);
>  }
> @@ -685,8 +683,6 @@ static int __init pm_qos_power_init(void)
>         BUILD_BUG_ON(ARRAY_SIZE(pm_qos_array) != PM_QOS_NUM_CLASSES);
>
>         d = debugfs_create_dir("pm_qos", NULL);
> -       if (IS_ERR_OR_NULL(d))
> -               d = NULL;
>
>         for (i = PM_QOS_CPU_DMA_LATENCY; i < PM_QOS_NUM_CLASSES; i++) {
>                 ret = register_pm_qos_misc(pm_qos_array[i], d);
> --
> 2.20.1
>

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

* Re: [PATCH] power: qos: no need to check return value of debugfs_create functions
  2019-01-22 15:30 ` Rafael J. Wysocki
@ 2019-01-22 15:53   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 15:53 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux Kernel Mailing List, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Linux PM

On Tue, Jan 22, 2019 at 04:30:38PM +0100, Rafael J. Wysocki wrote:
> On Tue, Jan 22, 2019 at 4:25 PM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> 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: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> > Cc: Len Brown <len.brown@intel.com>
> > Cc: Pavel Machek <pavel@ucw.cz>
> > Cc: linux-pm@vger.kernel.org
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> All of these changes are fine by me and I can take the patches
> touching the code maintained by me, so please let me know.

Please take them!

thanks,

greg k-h

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

* Re: [PATCH] power: qos: no need to check return value of debugfs_create functions
  2019-01-22 15:21 [PATCH] power: qos: no need to check return value of debugfs_create functions Greg Kroah-Hartman
  2019-01-22 15:30 ` Rafael J. Wysocki
@ 2019-01-24 10:42 ` Rafael J. Wysocki
  1 sibling, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2019-01-24 10:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Len Brown, Pavel Machek, linux-pm

On Tuesday, January 22, 2019 4:21:47 PM CET 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: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Len Brown <len.brown@intel.com>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: linux-pm@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  kernel/power/qos.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/power/qos.c b/kernel/power/qos.c
> index b7a82502857a..9d22131afc1e 100644
> --- a/kernel/power/qos.c
> +++ b/kernel/power/qos.c
> @@ -582,10 +582,8 @@ static int register_pm_qos_misc(struct pm_qos_object *qos, struct dentry *d)
>  	qos->pm_qos_power_miscdev.name = qos->name;
>  	qos->pm_qos_power_miscdev.fops = &pm_qos_power_fops;
>  
> -	if (d) {
> -		(void)debugfs_create_file(qos->name, S_IRUGO, d,
> -					  (void *)qos, &pm_qos_debug_fops);
> -	}
> +	debugfs_create_file(qos->name, S_IRUGO, d, (void *)qos,
> +			    &pm_qos_debug_fops);
>  
>  	return misc_register(&qos->pm_qos_power_miscdev);
>  }
> @@ -685,8 +683,6 @@ static int __init pm_qos_power_init(void)
>  	BUILD_BUG_ON(ARRAY_SIZE(pm_qos_array) != PM_QOS_NUM_CLASSES);
>  
>  	d = debugfs_create_dir("pm_qos", NULL);
> -	if (IS_ERR_OR_NULL(d))
> -		d = NULL;
>  
>  	for (i = PM_QOS_CPU_DMA_LATENCY; i < PM_QOS_NUM_CLASSES; i++) {
>  		ret = register_pm_qos_misc(pm_qos_array[i], d);
> 

Applied, thanks!



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

end of thread, other threads:[~2019-01-24 10:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-22 15:21 [PATCH] power: qos: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-01-22 15:30 ` Rafael J. Wysocki
2019-01-22 15:53   ` Greg Kroah-Hartman
2019-01-24 10:42 ` Rafael J. Wysocki

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.