[PATCH 0/2] clk: fix a bug in CCF which results in a clock being enabled twice.

Yang Xiwen via B4 Relay devnull+forbidden405.outlook.com at kernel.org
Sun Jul 23 23:16:53 CEST 2023


Currently, ccf_clk_endisable() calls clk_enable() / clk_disable()
directly depending on the request. However, this function is also
referenced in clk->ops, which is also called in clk_enable() /
clk_disable().

This caused a recursion and made the clock enabled twice if clk_enable()
is invoked. So we have to call clk_disable() twice to disable the clock.
It can be easily reproduced with few extra lines of debug code.

Fix that by calling clk->ops->enable/disable directly in
ccf_clk_endisable() rather than using the framework functions.

Signed-off-by: Yang Xiwen <forbidden405 at outlook.com>
---
Yang Xiwen (2):
      clk: move clk_get_ops() to a common header
      clk: ccf: invoke ops provided by clk directly

 drivers/clk/clk-uclass.c |  5 -----
 drivers/clk/clk.c        | 10 ++++++++--
 include/clk.h            | 17 +++++++++++++++++
 3 files changed, 25 insertions(+), 7 deletions(-)
---
base-commit: 580eb31199be8a822e62f20965854a242f895d03
change-id: 20230724-clk_fix-1b7265d663a8

Best regards,
-- 
Yang Xiwen <forbidden405 at outlook.com>



More information about the U-Boot mailing list