nouveau: no need to check return value of debugfs_create functions
Subsystems (3)
PATCH 1/1 nouveau: 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.
--- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/nouveau/nouveau_debugfs.c +4 -8
@@ -224,14 +224,10 @@ nouveau_drm_debugfs_init(struct drm_minor *minor)struct dentry *dentry;int i; -for (i =0 ; i <ARRAY_SIZE (nouveau_debugfs_files); i++) { - dentry =debugfs_create_file (nouveau_debugfs_files[i].name, -S_IRUGO |S_IWUSR , - minor->debugfs_root, minor->dev, - nouveau_debugfs_files[i].fops); -if (!dentry) -return -ENOMEM ; - } +for (i =0 ; i <ARRAY_SIZE (nouveau_debugfs_files); i++) +debugfs_create_file (nouveau_debugfs_files[i].name, +S_IRUGO |S_IWUSR , minor->debugfs_root, + minor->dev, nouveau_debugfs_files[i].fops); drm_debugfs_create_files(nouveau_debugfs_list, NOUVEAU_DEBUGFS_ENTRIES,
Signature · 6 lines
2.25.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 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.
Thanks!
Quoted 37 lines
Cc Ben Skeggs <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)drivers/gpu/drm/nouveau/nouveau_debugfs.c +4
-9@@ -224,14 +224,10 @@ nouveau_drm_debugfs_init(struct drm_minor *minor)struct dentry *dentry;int i; -for (i =0 ; i <ARRAY_SIZE (nouveau_debugfs_files); i++) { - dentry =debugfs_create_file (nouveau_debugfs_files[i].name, -S_IRUGO |S_IWUSR , - minor->debugfs_root, minor->dev, - nouveau_debugfs_files[i].fops); -if (!dentry) -return -ENOMEM ; - } +for (i =0 ; i <ARRAY_SIZE (nouveau_debugfs_files); i++) +debugfs_create_file (nouveau_debugfs_files[i].name, +S_IRUGO |S_IWUSR , minor->debugfs_root, + minor->dev, nouveau_debugfs_files[i].fops); drm_debugfs_create_files(nouveau_debugfs_list, NOUVEAU_DEBUGFS_ENTRIES, --2.25.0
Quoted 4 lines
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 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.
Should we follow that line of reasoning further, and simply return void from the debugfs functions--rather than playing whack-a-mole with this indefinitely?
thanks,
Signature · 2 lines
John Hubbard NVIDIA
Quoted 24 lines
Cc Ben Skeggs <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)drivers/gpu/drm/nouveau/nouveau_debugfs.c +0
-5@@ -224,14 +224,10 @@ nouveau_drm_debugfs_init(struct drm_minor *minor)struct dentry *dentry;int i; -for (i =0 ; i <ARRAY_SIZE (nouveau_debugfs_files); i++) { - dentry =debugfs_create_file (nouveau_debugfs_files[i].name, -S_IRUGO |S_IWUSR , - minor->debugfs_root, minor->dev, - nouveau_debugfs_files[i].fops);
drivers/gpu/drm/nouveau/nouveau_debugfs.c nouveau_drm_debugfs_init(struct drm_minor *minor) · line 233
Quoted 10 lines
drivers/gpu/drm/nouveau/nouveau_debugfs.c +4
-3-if (!dentry) -return -ENOMEM ; - } +for (i =0 ; i <ARRAY_SIZE (nouveau_debugfs_files); i++) +debugfs_create_file (nouveau_debugfs_files[i].name, +S_IRUGO |S_IWUSR , minor->debugfs_root, + minor->dev, nouveau_debugfs_files[i].fops); drm_debugfs_create_files(nouveau_debugfs_list, NOUVEAU_DEBUGFS_ENTRIES,
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · John Hubbard
Quoted 4 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.
Should we follow that line of reasoning further, and simply return void from the debugfs functions--rather than playing whack-a-mole with this indefinitely?
That is what we (well I) have been doing. Look at all of the changes that have happened to include/linux/debugfs.h over the past few releases. I'm slowly winnowing down the api to make it impossible to get wrong for this type of thing, and am almost there.
DRM is the big fish left to tackle, I have submitted some patches in the past, but lots more cleanup needs to be done to get them into mergable shape. I just need to find the time...
thanks,
greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 7 lines · Greg Kroah-Hartman
Quoted 6 lines · John Hubbard
Quoted 4 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.
Quoted 9 lines
Quoted 3 lines
Should we follow that line of reasoning further, and simply return void from the debugfs functions--rather than playing whack-a-mole with this indefinitely?
That is what we (well I) have been doing. Look at all of the changes that have happened to
include/linux/debugfs.hover the past few releases. I'm slowly winnowing down the api to make it impossible to get wrong for this type of thing, and am almost there.
Oops, I see now that you have already been very busy with this. :) Looking good...
thanks,
Signature · 2 lines
John Hubbard NVIDIA
Quoted 8 lines
DRM is the big fish left to tackle, I have submitted some patches in the past, but lots more cleanup needs to be done to get them into mergable shape. I just need to find the time...
Quoted 1 line
thanks,
greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 12 lines · Greg Kroah-Hartman
Quoted 9 lines · John Hubbard
Quoted 4 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.
Should we follow that line of reasoning further, and simply return void from the debugfs functions--rather than playing whack-a-mole with this indefinitely?
Quoted 8 lines
That is what we (well I) have been doing. Look at all of the changes that have happened to
include/linux/debugfs.hover the past few releases. I'm slowly winnowing down the api to make it impossible to get wrong for this type of thing, and am almost there.DRM is the big fish left to tackle, I have submitted some patches in the past, but lots more cleanup needs to be done to get them into mergable shape. I just need to find the time...
Just to avoid duplication, Wambui (cc'ed) just started working on this. Expect a lot more void return values and a pile of deleted code rsn.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 19 lines · Daniel Vetter
Quoted 17 lines · Greg Kroah-Hartman
Quoted 9 lines · John Hubbard
Quoted 4 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.
Should we follow that line of reasoning further, and simply return void from the debugfs functions--rather than playing whack-a-mole with this indefinitely?
That is what we (well I) have been doing. Look at all of the changes that have happened to
include/linux/debugfs.hover the past few releases. I'm slowly winnowing down the api to make it impossible to get wrong for this type of thing, and am almost there.
Quoted 7 lines
Quoted 3 lines
DRM is the big fish left to tackle, I have submitted some patches in the past, but lots more cleanup needs to be done to get them into mergable shape. I just need to find the time...
Just to avoid duplication, Wambui (cc'ed) just started working on this. Expect a lot more void return values and a pile of deleted code rsn.
Nice!
It's not duplication if I haven't started on it :)
greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel