Skip to content

Commit 4844bdb

Browse files
digetxvireshk
authored andcommitted
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 <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Signed-off-by: Viresh Kumar <[email protected]>
1 parent 68b79f2 commit 4844bdb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/devfreq/tegra30-devfreq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -891,9 +891,9 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
891891
return err;
892892

893893
rate = clk_round_rate(tegra->emc_clock, ULONG_MAX);
894-
if (rate < 0) {
894+
if (rate <= 0) {
895895
dev_err(&pdev->dev, "Failed to round clock rate: %ld\n", rate);
896-
return rate;
896+
return rate ?: -EINVAL;
897897
}
898898

899899
tegra->max_freq = rate / KHZ;

0 commit comments

Comments
 (0)