Skip to contentSkip to conversation

panel: rocktech: no need to check return value of debugfs_create functions

PATCH Applied Greg Kroah-Hartman 3 participants 4 messages Jun 13, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 panel: rocktech: no need to check return value of debugfs_create functions

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 "Guido Günther" <[email protected]>
Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c +3 -11
index d88ea8da2ec2..6dcb692c4701 100644
@@ -257,20 +257,12 @@ static int allpixelson_set(void *data, u64 val)
 DEFINE_SIMPLE_ATTRIBUTE(allpixelson_fops, NULL,
 			allpixelson_set, "%llu\n");
 
-static int jh057n_debugfs_init(struct jh057n *ctx)
+static void jh057n_debugfs_init(struct jh057n *ctx)
 {
-	struct dentry *f;
-
 	ctx->debugfs = debugfs_create_dir(DRV_NAME, NULL);
-	if (!ctx->debugfs)
-		return -ENOMEM;
 
-	f = debugfs_create_file("allpixelson", 0600,
-				ctx->debugfs, ctx, &allpixelson_fops);
-	if (!f)
-		return -ENOMEM;
-
-	return 0;
+	debugfs_create_file("allpixelson", 0600, ctx->debugfs, ctx,
+			    &allpixelson_fops);
 }
 
 static void jh057n_debugfs_remove(struct jh057n *ctx)
Signature · 6 lines
2.22.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 32 lines · Greg Kroah-Hartman

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 "Guido Günther" <[email protected]>
Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c +1 -6
index d88ea8da2ec2..6dcb692c4701 100644
@@ -257,20 +257,12 @@ static int allpixelson_set(void *data, u64 val)
 DEFINE_SIMPLE_ATTRIBUTE(allpixelson_fops, NULL,
 			allpixelson_set, "%llu\n");
 
-static int jh057n_debugfs_init(struct jh057n *ctx)
+static void jh057n_debugfs_init(struct jh057n *ctx)
 {
-	struct dentry *f;
-
 	ctx->debugfs = debugfs_create_dir(DRV_NAME, NULL);
-	if (!ctx->debugfs)
-		return -ENOMEM;
 
-	f = debugfs_create_file("allpixelson", 0600,

drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c static int allpixelson_set(void *data, u64 val) · line 268

Quoted 10 lines
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c +2 -5
-				ctx->debugfs, ctx, &allpixelson_fops);
-	if (!f)
-		return -ENOMEM;
-
-	return 0;
+	debugfs_create_file("allpixelson", 0600, ctx->debugfs, ctx,
+			    &allpixelson_fops);
 }
 
 static void jh057n_debugfs_remove(struct jh057n *ctx)

Thanks,
-- Guido

Quoted 3 lines
Signature · 1 line
2.22.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
Quoted 43 lines · Guido Günther

Hi,

Quoted 41 lines · Greg Kroah-Hartman

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 "Guido Günther" <[email protected]>
Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c +3 -11
index d88ea8da2ec2..6dcb692c4701 100644
@@ -257,20 +257,12 @@ static int allpixelson_set(void *data, u64 val)
 DEFINE_SIMPLE_ATTRIBUTE(allpixelson_fops, NULL,
 			allpixelson_set, "%llu\n");
 
-static int jh057n_debugfs_init(struct jh057n *ctx)
+static void jh057n_debugfs_init(struct jh057n *ctx)
 {
-	struct dentry *f;
-
 	ctx->debugfs = debugfs_create_dir(DRV_NAME, NULL);
-	if (!ctx->debugfs)
-		return -ENOMEM;
 
-	f = debugfs_create_file("allpixelson", 0600,
-				ctx->debugfs, ctx, &allpixelson_fops);
-	if (!f)
-		return -ENOMEM;
-
-	return 0;
+	debugfs_create_file("allpixelson", 0600, ctx->debugfs, ctx,
+			    &allpixelson_fops);
 }
 
Quoted 3 lines

drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c static int allpixelson_set(void *data, u64 val) · line 268

Quoted 1 line
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c +0 -0
 static void jh057n_debugfs_remove(struct jh057n *ctx)

Applied to drm-misc-next, thanks.

For the others I'll assume drivers maintainers will pick them up. If not pls ping/resend and I'll stuff all the remaining ones into drm-misc-next.

Thanks, Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw
Quoted 44 lines · Daniel Vetter
Quoted 43 lines · Guido Günther

Hi,

Quoted 41 lines · Greg Kroah-Hartman

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 "Guido Günther" <[email protected]>
Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c +3 -11
index d88ea8da2ec2..6dcb692c4701 100644
@@ -257,20 +257,12 @@ static int allpixelson_set(void *data, u64 val)
 DEFINE_SIMPLE_ATTRIBUTE(allpixelson_fops, NULL,
 			allpixelson_set, "%llu\n");
 
-static int jh057n_debugfs_init(struct jh057n *ctx)
+static void jh057n_debugfs_init(struct jh057n *ctx)
 {
-	struct dentry *f;
-
 	ctx->debugfs = debugfs_create_dir(DRV_NAME, NULL);
-	if (!ctx->debugfs)
-		return -ENOMEM;
 
-	f = debugfs_create_file("allpixelson", 0600,
-				ctx->debugfs, ctx, &allpixelson_fops);
-	if (!f)
-		return -ENOMEM;
-
-	return 0;
+	debugfs_create_file("allpixelson", 0600, ctx->debugfs, ctx,
+			    &allpixelson_fops);
 }
 
Quoted 8 lines
Quoted 3 lines

drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c static int allpixelson_set(void *data, u64 val) · line 268

Quoted 1 line
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c +0 -0
 static void jh057n_debugfs_remove(struct jh057n *ctx)

Applied to drm-misc-next, thanks.

For the others I'll assume drivers maintainers will pick them up. If not pls ping/resend and I'll stuff all the remaining ones into drm-misc-next.

Thanks, will do.

greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel