]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
clk: tegra: Avoid calling an uninitialized function
authorThierry Reding <treding@nvidia.com>
Fri, 30 Jun 2023 13:07:48 +0000 (15:07 +0200)
committerStephen Boyd <sboyd@kernel.org>
Tue, 4 Jul 2023 15:54:37 +0000 (08:54 -0700)
Commit 493ffb046cf5 ("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: 493ffb046cf5 ("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>
drivers/clk/tegra/clk-tegra-super-cclk.c

index 68d7bcd5fc8a12cc202360913860385682dc226c..3b22a4d0dffcb2f81d549e06ee65a4173a582d2f 100644 (file)
@@ -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;