clk: Add clk_unregister_{divider, gate, mux} to close memory leak
The common clk_register_{divider,gate,mux} functions allocated memory for internal data which wasn't freed anywhere. Drivers using these helpers could only unregister clocks but the memory would still leak. Add corresponding unregister functions which will release all resources. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Michael Turquette <mturquette@linaro.org>
This commit is contained in:

committed by
Michael Turquette

parent
0c7665c356
commit
4e3c021fb9
@@ -162,3 +162,19 @@ struct clk *clk_register_gate(struct device *dev, const char *name,
|
||||
return clk;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(clk_register_gate);
|
||||
|
||||
void clk_unregister_gate(struct clk *clk)
|
||||
{
|
||||
struct clk_gate *gate;
|
||||
struct clk_hw *hw;
|
||||
|
||||
hw = __clk_get_hw(clk);
|
||||
if (!hw)
|
||||
return;
|
||||
|
||||
gate = to_clk_gate(hw);
|
||||
|
||||
clk_unregister(clk);
|
||||
kfree(gate);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(clk_unregister_gate);
|
||||
|
Reference in New Issue
Block a user