Skip to content

Commit

Permalink
clk: clean up everything on debugfs error
Browse files Browse the repository at this point in the history
[Maybe the third time will be the charm. -Alex]

If CONFIG_COMMON_CLK_DEBUG is defined, clk_debug_create_one() is
called to populate a debugfs directory with a few entries that are
common for all clock types.

If an error happens after creating the first one debugfs_remove() is
called on the clock's directory.  The problem with this is that no
cleanup is done on the debugfs files already created in that
directory, so the directory never actually gets removed.   This
problem is silently ignored.

Fix this by calling debugfs_remove_recursive() instead.  Reset the
clk->dentry field to null afterward, to ensure it can't be mistaken
as a valid pointer.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
  • Loading branch information
Alex Elder authored and Mike Turquette committed Nov 27, 2013
1 parent 6ce4eac commit b5f98e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/clk/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ static int clk_debug_create_one(struct clk *clk, struct dentry *pdentry)
goto out;

err_out:
debugfs_remove(clk->dentry);
debugfs_remove_recursive(clk->dentry);
clk->dentry = NULL;
out:
return ret;
}
Expand Down

0 comments on commit b5f98e6

Please sign in to comment.