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>
This commit is contained in:
Dmitry Osipenko 2021-09-20 20:22:49 +03:00 committed by Viresh Kumar
parent 68b79f2855
commit 4844bdbe91
1 changed files with 2 additions and 2 deletions

View File

@ -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;