Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Dmitry Osipenko and committed by
Viresh Kumar
4844bdbe 68b79f28

+2 -2
+2 -2
drivers/devfreq/tegra30-devfreq.c
··· 891 891 return err; 892 892 893 893 rate = clk_round_rate(tegra->emc_clock, ULONG_MAX); 894 - if (rate < 0) { 894 + if (rate <= 0) { 895 895 dev_err(&pdev->dev, "Failed to round clock rate: %ld\n", rate); 896 - return rate; 896 + return rate ?: -EINVAL; 897 897 } 898 898 899 899 tegra->max_freq = rate / KHZ;