Skip to content

Commit 04bf9ab

Browse files
jbrun3tbebarino
authored andcommitted
clk: fix determine rate error with pass-through clock
If we try to determine the rate of a pass-through clock (a clock which does not implement .round_rate() nor .determine_rate()), clk_core_round_rate_nolock() will directly forward the call to the parent clock. In the particular case where the pass-through actually does not have a parent, clk_core_round_rate_nolock() will directly return 0 with the requested rate still set to the initial request structure. This is interpreted as if the rate could be exactly achieved while it actually cannot be adjusted. This become a real problem when this particular pass-through clock is the parent of a mux with the flag CLK_SET_RATE_PARENT set. The pass-through clock will always report an exact match, get picked and finally error when the rate is actually getting set. This is fixed by setting the rate inside the req to 0 when core is NULL in clk_core_round_rate_nolock() (same as in __clk_determine_rate() when hw is NULL) Fixes: 0f6cc2b ("clk: rework calls to round and determine rate callbacks") Signed-off-by: Jerome Brunet <[email protected]> Signed-off-by: Michael Turquette <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 99652a4 commit 04bf9ab

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/clk/clk.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,8 +1125,10 @@ static int clk_core_round_rate_nolock(struct clk_core *core,
11251125
{
11261126
lockdep_assert_held(&prepare_lock);
11271127

1128-
if (!core)
1128+
if (!core) {
1129+
req->rate = 0;
11291130
return 0;
1131+
}
11301132

11311133
clk_core_init_rate_req(core, req);
11321134

0 commit comments

Comments
 (0)