diff options
author | Dmitry Osipenko <digetx@gmail.com> | 2021-09-20 19:22:49 +0200 |
---|---|---|
committer | Viresh Kumar <viresh.kumar@linaro.org> | 2021-10-05 06:24:39 +0200 |
commit | 4844bdbe9166bc3d194b1d20d13dc1f01d3c1bb7 (patch) | |
tree | c821575f99ac813fbcf890154f9bafe4237b12a5 | |
parent | PM / devfreq: tegra30: Use resource-managed helpers (diff) | |
download | linux-4844bdbe9166bc3d194b1d20d13dc1f01d3c1bb7.tar.xz linux-4844bdbe9166bc3d194b1d20d13dc1f01d3c1bb7.zip |
PM / devfreq: tegra30: Check whether clk_round_rate() returns zero rate
EMC clock is always-on and can't be zero. Check whether clk_round_rate()
returns zero rate and error out if it does. It can return zero if clock
tree isn't initialized properly.
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
-rw-r--r-- | drivers/devfreq/tegra30-devfreq.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c index d83fdc2713ed..65ecf17a36f4 100644 --- a/drivers/devfreq/tegra30-devfreq.c +++ b/drivers/devfreq/tegra30-devfreq.c @@ -891,9 +891,9 @@ static int tegra_devfreq_probe(struct platform_device *pdev) return err; rate = clk_round_rate(tegra->emc_clock, ULONG_MAX); - if (rate < 0) { + if (rate <= 0) { dev_err(&pdev->dev, "Failed to round clock rate: %ld\n", rate); - return rate; + return rate ?: -EINVAL; } tegra->max_freq = rate / KHZ; |