debugfs: change parameter check in debugfs_remove() functions
PATCH 1/1 debugfs: change parameter check in debugfs_remove() functions
The dentry parameter in debugfs_remove() and debugfs_remove_recursive() is checked being a NULL pointer. To make cleanup by callers easier this check is extended using the IS_ERR_OR_NULL macro instead because the debugfs_create_... functions can return a ERR_PTR() value.
---
I was adding the check in driver code before calling the recursive remove, but considered it might be a better idea to do it in debugfs itself.
No rush so I target to include it in v3.6. The patch is based on v3.4 tag.
Gr. AvS
--- fs/debugfs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/debugfs/inode.c +2 -2
@@ -498,7 +498,7 @@ void debugfs_remove(struct dentry *dentry)struct dentry *parent;int ret; -if (!dentry) +if (IS_ERR_OR_NULL (dentry))return ; parent = dentry->d_parent;
@@ -530,7 +530,7 @@ void debugfs_remove_recursive(struct dentry *dentry)struct dentry *child;struct dentry *parent; -if (!dentry) +if (IS_ERR_OR_NULL (dentry))return ; parent = dentry->d_parent;
Signature · 1 line
1.7.9.5
Greg Kroah-Hartman
maintainerQuoted 9 lines · Arend van Spriel
The dentry parameter in
debugfs_remove()anddebugfs_remove_recursive()is checked being a NULL pointer. To make cleanup by callers easier this check is extended using theIS_ERR_OR_NULLmacro instead because thedebugfs_create_... functions can return aERR_PTR()value.Signed-off-by Arend van Spriel <[email protected]>---
I was adding the check in driver code before calling the recursive remove, but considered it might be a better idea to do it in debugfs itself.
Yes, nice change, thanks.
I'll queue it up after 3.5-rc1 is out.
thanks,
greg k-h