Thread (13 messages) 13 messages, 2 authors, 2021-09-19

Re: [PATCH v1 4/4] PM / devfreq: tegra30: Check whether clk_round_rate() returns zero rate

From: Chanwoo Choi <hidden>
Date: 2021-09-15 03:51:22
Also in: linux-pm, lkml

Hi,

On 21. 9. 13. 오전 3:44, Dmitry Osipenko wrote:
quoted hunk ↗ jump to hunk
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.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
  drivers/devfreq/tegra30-devfreq.c | 4 ++--
  1 file 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;
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>

-- 
Best Regards,
Samsung Electronics
Chanwoo Choi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help