Skip to contentSkip to conversation

komeda: no need to check return value of debugfs_create functions

PATCH In review Greg Kroah-Hartman 3 participants 3 messages Jun 13, 2019 – Jun 14, 2019

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

PATCH 1/1 komeda: 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 "James (Qian) Wang" <[email protected]>
Cc Liviu Dudau <[email protected]>
Cc Brian Starkey <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -3
index ca3599e4a4d3..58100edf58fa 100644
@@ -51,9 +51,6 @@ static void komeda_debugfs_init(struct komeda_dev *mdev)
 		return;
 
 	mdev->debugfs_root = debugfs_create_dir("komeda", NULL);
-	if (IS_ERR_OR_NULL(mdev->debugfs_root))
-		return;
-
 	debugfs_create_file("register", 0444, mdev->debugfs_root,
 			    mdev, &komeda_register_fops);
 }
Signature · 6 lines
2.22.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by on v1 1/1
#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 "James (Qian) Wang" <[email protected]>
Cc Liviu Dudau <[email protected]>
Cc Brian Starkey <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>

Thanks for the patch, I'll pull it into malidp tree (shared with komeda).

Best regards,
Liviu

Quoted 21 lines
---
 drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -3
index ca3599e4a4d3..58100edf58fa 100644
@@ -51,9 +51,6 @@ static void komeda_debugfs_init(struct komeda_dev *mdev)
 		return;
 
 	mdev->debugfs_root = debugfs_create_dir("komeda", NULL);
-	if (IS_ERR_OR_NULL(mdev->debugfs_root))
-		return;
-
 	debugfs_create_file("register", 0444, mdev->debugfs_root,
 			    mdev, &komeda_register_fops);
 }
Signature · 1 line
2.22.0
Signature · 12 lines
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
In reply to Greg Kroah-Hartman
Quoted 31 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 "James (Qian) Wang" <[email protected]>
Cc Liviu Dudau <[email protected]>
Cc Brian Starkey <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -3
index ca3599e4a4d3..58100edf58fa 100644
@@ -51,9 +51,6 @@ static void komeda_debugfs_init(struct komeda_dev *mdev)
 		return;
 
 	mdev->debugfs_root = debugfs_create_dir("komeda", NULL);
-	if (IS_ERR_OR_NULL(mdev->debugfs_root))
-		return;
-
 	debugfs_create_file("register", 0444, mdev->debugfs_root,
 			    mdev, &komeda_register_fops);
 }
Signature · 1 line
2.22.0

Hi Greg;

Thank you for helping to fix this problem.

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