Skip to content

Commit

Permalink
clk: tegra: Avoid calling an uninitialized function
Browse files Browse the repository at this point in the history
Commit 493ffb0 ("clk: tegra: super: Switch to determine_rate")
replaced clk_super_round_rate() by clk_super_determine_rate(), but
didn't update one callsite that was explicitly calling the old
tegra_clk_super_ops.round_rate() function, which was now NULL. This
resulted in a crash on Tegra30 systems during early boot.

Switch this callsite over to the clk_super_determine_rate() equivalent
to avoid the crash.

Fixes: 493ffb0 ("clk: tegra: super: Switch to determine_rate")
Tested-by: Dmitry Osipenko <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Stephen Boyd <[email protected]>
  • Loading branch information
thierryreding authored and bebarino committed Jul 4, 2023
1 parent b211542 commit f679e89
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions drivers/clk/tegra/clk-tegra-super-cclk.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,18 @@ static int cclk_super_determine_rate(struct clk_hw *hw,
if (rate <= pllp_rate) {
if (super->flags & TEGRA20_SUPER_CLK)
rate = pllp_rate;
else
rate = tegra_clk_super_ops.round_rate(hw, rate,
&pllp_rate);
else {
struct clk_rate_request parent = {
.rate = req->rate,
.best_parent_rate = pllp_rate,
};

clk_hw_get_rate_range(hw, &parent.min_rate,
&parent.max_rate);
tegra_clk_super_ops.determine_rate(hw, &parent);
pllp_rate = parent.best_parent_rate;
rate = parent.rate;
}

req->best_parent_rate = pllp_rate;
req->best_parent_hw = pllp_hw;
Expand Down

0 comments on commit f679e89

Please sign in to comment.