Skip to content

Commit f679e89

Browse files
thierryredingbebarino
authored andcommitted
clk: tegra: Avoid calling an uninitialized function
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 <digetx@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Link: https://lore.kernel.org/r/20230630130748.840729-1-thierry.reding@gmail.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent b211542 commit f679e89

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

drivers/clk/tegra/clk-tegra-super-cclk.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,18 @@ static int cclk_super_determine_rate(struct clk_hw *hw,
8686
if (rate <= pllp_rate) {
8787
if (super->flags & TEGRA20_SUPER_CLK)
8888
rate = pllp_rate;
89-
else
90-
rate = tegra_clk_super_ops.round_rate(hw, rate,
91-
&pllp_rate);
89+
else {
90+
struct clk_rate_request parent = {
91+
.rate = req->rate,
92+
.best_parent_rate = pllp_rate,
93+
};
94+
95+
clk_hw_get_rate_range(hw, &parent.min_rate,
96+
&parent.max_rate);
97+
tegra_clk_super_ops.determine_rate(hw, &parent);
98+
pllp_rate = parent.best_parent_rate;
99+
rate = parent.rate;
100+
}
92101

93102
req->best_parent_rate = pllp_rate;
94103
req->best_parent_hw = pllp_hw;

0 commit comments

Comments
 (0)