Skip to content

Commit

Permalink
PM / devfreq: tegra30: Check whether clk_round_rate() returns zero rate
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
digetx authored and vireshk committed Oct 5, 2021
1 parent 68b79f2 commit 4844bdb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/devfreq/tegra30-devfreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4844bdb

Please sign in to comment.