Skip to contentSkip to conversation

sti: no need to check return value of debugfs_create functions

PATCH In review Greg Kroah-Hartman 2 participants 2 messages Jun 13, 2019

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

PATCH 1/1 sti: 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 Benjamin Gaignard <[email protected]>
Cc Vincent Abriou <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/sti/sti_drv.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/gpu/drm/sti/sti_drv.c +2 -8
index a525fd899f68..4797e46bf384 100644
@@ -95,7 +95,6 @@ static struct drm_info_list sti_drm_dbg_list[] = {
 
 static int sti_drm_dbg_init(struct drm_minor *minor)
 {
-	struct dentry *dentry;
 	int ret;
 
 	ret = drm_debugfs_create_files(sti_drm_dbg_list,
@@ -104,13 +103,8 @@ static int sti_drm_dbg_init(struct drm_minor *minor)
 	if (ret)
 		goto err;
 
-	dentry = debugfs_create_file("fps_show", S_IRUGO | S_IWUSR,
-				     minor->debugfs_root, minor->dev,
-				     &sti_drm_fps_fops);
-	if (!dentry) {
-		ret = -ENOMEM;
-		goto err;
-	}
+	debugfs_create_file("fps_show", S_IRUGO | S_IWUSR, minor->debugfs_root,
+			    minor->dev, &sti_drm_fps_fops);
 
 	DRM_INFO("%s: debugfs installed\n", DRIVER_NAME);
 	return 0;
Signature · 6 lines
2.22.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 11 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 Benjamin Gaignard <[email protected]>
Cc Vincent Abriou <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>

Applied on drm-misc-next.
Thanks,
Benjamin

Quoted 33 lines
---
 drivers/gpu/drm/sti/sti_drv.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/gpu/drm/sti/sti_drv.c +2 -9
index a525fd899f68..4797e46bf384 100644
@@ -95,7 +95,6 @@ static struct drm_info_list sti_drm_dbg_list[] = {
 
 static int sti_drm_dbg_init(struct drm_minor *minor)
 {
-       struct dentry *dentry;
        int ret;
 
        ret = drm_debugfs_create_files(sti_drm_dbg_list,
@@ -104,13 +103,8 @@ static int sti_drm_dbg_init(struct drm_minor *minor)
        if (ret)
                goto err;
 
-       dentry = debugfs_create_file("fps_show", S_IRUGO | S_IWUSR,
-                                    minor->debugfs_root, minor->dev,
-                                    &sti_drm_fps_fops);
-       if (!dentry) {
-               ret = -ENOMEM;
-               goto err;
-       }
+       debugfs_create_file("fps_show", S_IRUGO | S_IWUSR, minor->debugfs_root,
+                           minor->dev, &sti_drm_fps_fops);
 
        DRM_INFO("%s: debugfs installed\n", DRIVER_NAME);
        return 0;
--
Quoted 2 lines

2.22.0

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