clk: fixed: fix double free in resource managed fixed-factor clock

devm_clk_hw_register_fixed_factor_release(), the release function for
the devm_clk_hw_register_fixed_factor(), calls
clk_hw_unregister_fixed_factor(), which will kfree() the clock. However
after that the devres functions will also kfree the allocated data,
resulting in double free/memory corruption. Just call
clk_hw_unregister() instead, leaving kfree() to devres code.

Reported-by: Rob Clark <>
Cc: Daniel Palmer <>
Signed-off-by: Dmitry Baryshkov <>
Fixes: 0b9266d295ce ("clk: fixed: add devm helper for clk_hw_register_fixed_factor()")
[ Remove ugly cast]
Signed-off-by: Stephen Boyd <>
1 file changed