On 8/6/19 11:22 AM, Mark Brown wrote:
On Tue, Aug 06, 2019 at 09:49:20AM -0500, Pierre-Louis Bossart wrote:
{
+ if (!component->debugfs_root)
+ return;
that test is redundant, it's safe to call debugfs_remove_recursive() without
checking the argument (done internally).
It's not completely redundant...
debugfs_remove_recursive(component->debugfs_root);
+ component->debugfs_root = NULL;
}
...with this, the two in combination add protection against a double
free. Not 100% sure it's worth it but I queued the patch since I
couldn't strongly convince myself it's a bad idea.
I was only referring to the first test, which will be duplicated. see below.
The second part is just fine.
/**
* debugfs_remove_recursive - recursively removes a directory
* @dentry: a pointer to a the dentry of the directory to be removed.
If this
* parameter is NULL or an error value, nothing will be done.
*
* This function recursively removes a directory tree in debugfs that
* was previously created with a call to another debugfs function
* (like debugfs_create_file() or variants thereof.)
*
* This function is required to be called in order for the file to be
* removed, no automatic cleanup of files will happen when a module is
* removed, you are responsible here.
*/
void debugfs_remove_recursive(struct dentry *dentry)
{
struct dentry *child, *parent;
if (IS_ERR_OR_NULL(dentry))
return;
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel