omapdrm: no need to check return value of debugfs_create functions
Subsystems (3)
PATCH 1/1 omapdrm: 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/omapdrm/dss/dss.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/gpu/drm/omapdrm/dss/dss.c +2 -9
@@ -934,7 +934,6 @@ dss_debugfs_create_file(struct dss_device *dss, const char *name, void *data) {struct dss_debugfs_entry *entry; -struct dentry *d; entry =kzalloc (sizeof (*entry),GFP_KERNEL );if (!entry)
@@ -942,15 +941,9 @@ dss_debugfs_create_file(struct dss_device *dss, const char *name, entry->show_fn = show_fn; entry->data = data; + entry->dentry =debugfs_create_file (name,0444 , dss->debugfs.root, + entry, &dss_debug_fops); - d =debugfs_create_file (name,0444 , dss->debugfs.root, entry, - &dss_debug_fops); -if (IS_ERR (d)) { -kfree (entry); -return ERR_CAST (d); - } - - entry->dentry = d;return entry; }
Signature · 6 lines
2.22.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Greg,
Thank you for the patch.
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 10 lines
Cc Tomi Valkeinen <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Sebastian Reichel <[email protected]>Cc Jyri Sarha <[email protected]>Cc Tony Lindgren <[email protected]>Cc zhong jiang <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
This makes sense.
Tomi, will you take this patch in your tree ?
Quoted 34 lines
--- drivers/gpu/drm/omapdrm/dss/dss.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)drivers/gpu/drm/omapdrm/dss/dss.c +2
-9@@ -934,7 +934,6 @@ dss_debugfs_create_file(struct dss_device *dss, const char *name, void *data) {struct dss_debugfs_entry *entry; -struct dentry *d; entry =kzalloc (sizeof (*entry),GFP_KERNEL );if (!entry)@@ -942,15 +941,9 @@ dss_debugfs_create_file(struct dss_device *dss, const char *name, entry->show_fn = show_fn; entry->data = data; + entry->dentry =debugfs_create_file (name,0444 , dss->debugfs.root, + entry, &dss_debug_fops); - d =debugfs_create_file (name,0444 , dss->debugfs.root, entry, - &dss_debug_fops); -if (IS_ERR (d)) { -kfree (entry); -return ERR_CAST (d); - } - - entry->dentry = d;return entry; }
Signature · 7 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi,
Quoted 20 lines · Laurent Pinchart
Hi Greg,
Thank you for the patch.
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 10 lines
Cc Tomi Valkeinen <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Sebastian Reichel <[email protected]>Cc Jyri Sarha <[email protected]>Cc Tony Lindgren <[email protected]>Cc zhong jiang <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 5 lines
This makes sense.
Reviewed-by Laurent Pinchart <[email protected]>Tomi, will you take this patch in your tree ?
Yes, I'll pick this up. I presume debugfs_create_file() will give a warning print if it fails to create the file, instead of being silent.
Tomi
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 23 lines · Tomi Valkeinen
Hi,
Quoted 20 lines · Laurent Pinchart
Hi Greg,
Thank you for the patch.
Quoted 14 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 Tomi Valkeinen <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Sebastian Reichel <[email protected]>Cc Jyri Sarha <[email protected]>Cc Tony Lindgren <[email protected]>Cc zhong jiang <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 8 lines
Quoted 5 lines
This makes sense.
Reviewed-by Laurent Pinchart <[email protected]>Tomi, will you take this patch in your tree ?
Yes, I'll pick this up. I presume
debugfs_create_file()will give a warning print if it fails to create the file, instead of being silent.
Yes it does, please see 43e23b6c0b01 ("debugfs: log errors when something goes wrong") and c33d442328f5 ("debugfs: make error message a bit more verbose") for the details if you are curious.
Those warnings have already found at least one user of debugfs that was doing things wrong and no one had noticed before.
thanks,
greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel