All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] armada: no need to check return value of debugfs_create functions
@ 2019-06-13 13:28 Greg Kroah-Hartman
  2019-06-13 14:36 ` Russell King - ARM Linux admin
  0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-13 13:28 UTC (permalink / raw)
  To: Russell King, David Airlie, Daniel Vetter; +Cc: dri-devel

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: Russell King <linux@armlinux.org.uk>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/gpu/drm/armada/armada_debugfs.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_debugfs.c b/drivers/gpu/drm/armada/armada_debugfs.c
index 6758c3a83de2..aec1e7372371 100644
--- a/drivers/gpu/drm/armada/armada_debugfs.c
+++ b/drivers/gpu/drm/armada/armada_debugfs.c
@@ -109,7 +109,6 @@ static struct drm_info_list armada_debugfs_list[] = {
 
 int armada_drm_debugfs_init(struct drm_minor *minor)
 {
-	struct dentry *de;
 	int ret;
 
 	ret = drm_debugfs_create_files(armada_debugfs_list,
@@ -118,15 +117,10 @@ int armada_drm_debugfs_init(struct drm_minor *minor)
 	if (ret)
 		return ret;
 
-	de = debugfs_create_file("reg", S_IFREG | S_IRUSR,
-				 minor->debugfs_root, minor->dev, &fops_reg_r);
-	if (!de)
-		return -ENOMEM;
-
-	de = debugfs_create_file("reg_wr", S_IFREG | S_IWUSR,
-				 minor->debugfs_root, minor->dev, &fops_reg_w);
-	if (!de)
-		return -ENOMEM;
+	debugfs_create_file("reg", S_IFREG | S_IRUSR, minor->debugfs_root,
+			    minor->dev, &fops_reg_r);
+	debugfs_create_file("reg_wr", S_IFREG | S_IWUSR, minor->debugfs_root,
+			    minor->dev, &fops_reg_w);
 
 	return 0;
 }
-- 
2.22.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] armada: no need to check return value of debugfs_create functions
  2019-06-13 13:28 [PATCH] armada: no need to check return value of debugfs_create functions Greg Kroah-Hartman
@ 2019-06-13 14:36 ` Russell King - ARM Linux admin
  2019-06-13 16:01   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 5+ messages in thread
From: Russell King - ARM Linux admin @ 2019-06-13 14:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: David Airlie, dri-devel

On Thu, Jun 13, 2019 at 03:28:50PM +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.

Please don't merge this patch - I have a change that conflicts with this
which switches us over to using drm_debugfs_create_files(), thereby
eliminating this code.

> 
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/gpu/drm/armada/armada_debugfs.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/armada/armada_debugfs.c b/drivers/gpu/drm/armada/armada_debugfs.c
> index 6758c3a83de2..aec1e7372371 100644
> --- a/drivers/gpu/drm/armada/armada_debugfs.c
> +++ b/drivers/gpu/drm/armada/armada_debugfs.c
> @@ -109,7 +109,6 @@ static struct drm_info_list armada_debugfs_list[] = {
>  
>  int armada_drm_debugfs_init(struct drm_minor *minor)
>  {
> -	struct dentry *de;
>  	int ret;
>  
>  	ret = drm_debugfs_create_files(armada_debugfs_list,
> @@ -118,15 +117,10 @@ int armada_drm_debugfs_init(struct drm_minor *minor)
>  	if (ret)
>  		return ret;
>  
> -	de = debugfs_create_file("reg", S_IFREG | S_IRUSR,
> -				 minor->debugfs_root, minor->dev, &fops_reg_r);
> -	if (!de)
> -		return -ENOMEM;
> -
> -	de = debugfs_create_file("reg_wr", S_IFREG | S_IWUSR,
> -				 minor->debugfs_root, minor->dev, &fops_reg_w);
> -	if (!de)
> -		return -ENOMEM;
> +	debugfs_create_file("reg", S_IFREG | S_IRUSR, minor->debugfs_root,
> +			    minor->dev, &fops_reg_r);
> +	debugfs_create_file("reg_wr", S_IFREG | S_IWUSR, minor->debugfs_root,
> +			    minor->dev, &fops_reg_w);
>  
>  	return 0;
>  }
> -- 
> 2.22.0
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] armada: no need to check return value of debugfs_create functions
  2019-06-13 14:36 ` Russell King - ARM Linux admin
@ 2019-06-13 16:01   ` Greg Kroah-Hartman
  2019-06-13 16:15     ` Russell King - ARM Linux admin
  0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-13 16:01 UTC (permalink / raw)
  To: Russell King - ARM Linux admin; +Cc: David Airlie, dri-devel

On Thu, Jun 13, 2019 at 03:36:00PM +0100, Russell King - ARM Linux admin wrote:
> On Thu, Jun 13, 2019 at 03:28:50PM +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.
> 
> Please don't merge this patch - I have a change that conflicts with this
> which switches us over to using drm_debugfs_create_files(), thereby
> eliminating this code.

Isn't it "first received, first applied?"  That's how it is for my
subsystems...

Anyway, I have a much larger patch for all users of
drm_debugfs_create_files coming, but I'll wait for all of these tiny
ones to land before sending that out :)

thanks,

greg k-h
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] armada: no need to check return value of debugfs_create functions
  2019-06-13 16:01   ` Greg Kroah-Hartman
@ 2019-06-13 16:15     ` Russell King - ARM Linux admin
  2019-06-13 17:43       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 5+ messages in thread
From: Russell King - ARM Linux admin @ 2019-06-13 16:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: David Airlie, dri-devel

On Thu, Jun 13, 2019 at 06:01:14PM +0200, Greg Kroah-Hartman wrote:
> On Thu, Jun 13, 2019 at 03:36:00PM +0100, Russell King - ARM Linux admin wrote:
> > On Thu, Jun 13, 2019 at 03:28:50PM +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.
> > 
> > Please don't merge this patch - I have a change that conflicts with this
> > which switches us over to using drm_debugfs_create_files(), thereby
> > eliminating this code.
> 
> Isn't it "first received, first applied?"  That's how it is for my
> subsystems...

When I started working on the kernel in the 1990s, it was "the most
technically correct approach of competing approaches".  If we've
now switched to "first received, first applied" that can only be
harmful and demotivating to those who wish to do a good job.

If someone has a better approach ready to go, why should the
inferior approach be applied and then the better approach have to
be rebased on top of the inferior approach?  This makes no sense.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] armada: no need to check return value of debugfs_create functions
  2019-06-13 16:15     ` Russell King - ARM Linux admin
@ 2019-06-13 17:43       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-13 17:43 UTC (permalink / raw)
  To: Russell King - ARM Linux admin; +Cc: David Airlie, dri-devel

On Thu, Jun 13, 2019 at 05:15:59PM +0100, Russell King - ARM Linux admin wrote:
> On Thu, Jun 13, 2019 at 06:01:14PM +0200, Greg Kroah-Hartman wrote:
> > On Thu, Jun 13, 2019 at 03:36:00PM +0100, Russell King - ARM Linux admin wrote:
> > > On Thu, Jun 13, 2019 at 03:28:50PM +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.
> > > 
> > > Please don't merge this patch - I have a change that conflicts with this
> > > which switches us over to using drm_debugfs_create_files(), thereby
> > > eliminating this code.
> > 
> > Isn't it "first received, first applied?"  That's how it is for my
> > subsystems...
> 
> When I started working on the kernel in the 1990s, it was "the most
> technically correct approach of competing approaches".  If we've
> now switched to "first received, first applied" that can only be
> harmful and demotivating to those who wish to do a good job.
> 
> If someone has a better approach ready to go, why should the
> inferior approach be applied and then the better approach have to
> be rebased on top of the inferior approach?  This makes no sense.

If you have a better approach ready to go, please post it and I will be
glad to rebase my patch on top of yours.

greg k-h
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-06-13 17:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-13 13:28 [PATCH] armada: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-06-13 14:36 ` Russell King - ARM Linux admin
2019-06-13 16:01   ` Greg Kroah-Hartman
2019-06-13 16:15     ` Russell King - ARM Linux admin
2019-06-13 17:43       ` Greg Kroah-Hartman

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.