summaryrefslogtreecommitdiffstats
path: root/drivers/clk/tegra
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2021-05-16 18:30:37 +0200
committerThierry Reding <treding@nvidia.com>2021-05-31 15:16:26 +0200
commit78086386b3d1e363e2152066f48efcbdbb158d0f (patch)
treea722d5623f88bcfeed2154cca784c41f7dc24275 /drivers/clk/tegra
parentclk: tegra: Halve SCLK rate on Tegra20 (diff)
downloadlinux-78086386b3d1e363e2152066f48efcbdbb158d0f.tar.xz
linux-78086386b3d1e363e2152066f48efcbdbb158d0f.zip
clk: tegra: Don't allow zero clock rate for PLLs
Zero clock rate doesn't make sense for PLLs and tegra-clk driver enters into infinite loop on trying to calculate PLL parameters for zero rate. Make code to error out if requested rate is zero. Originally this trouble was found by Robert Yang while he was trying to bring up upstream kernel on Samsung Galaxy Tab, which happened due to a bug in Tegra DRM driver that erroneously sets PLL rate to zero. This issues came over again recently during of kernel bring up on ASUS TF700T. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/clk/tegra')
-rw-r--r--drivers/clk/tegra/clk-pll.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c
index 823a567f2adc..eaa079c177c3 100644
--- a/drivers/clk/tegra/clk-pll.c
+++ b/drivers/clk/tegra/clk-pll.c
@@ -558,6 +558,9 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,
u32 p_div = 0;
int ret;
+ if (!rate)
+ return -EINVAL;
+
switch (parent_rate) {
case 12000000:
case 26000000: