Skip to contentSkip to conversation

clk: tegra: Do not return 0 on failure

PATCH In review Nicolin Chen 3 participants 4 messages Oct 29, 2020 – Nov 25, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: tegra: Do not return 0 on failure

Return values from read_dt_param() will be either TRUE (1) or FALSE (0), while dfll_fetch_pwm_params() returns 0 on success or an ERR code on failure.

So this patch fixes the bug of returning 0 on failure.

Fixes 36541f0499fe ("clk: tegra: dfll: support PWM regulator control")
---
 drivers/clk/tegra/clk-dfll.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-dfll.c +2 -2
index cfbaa90c7adb..a5f526bb0483 100644
@@ -1856,13 +1856,13 @@ static int dfll_fetch_pwm_params(struct tegra_dfll *td)
 			    &td->reg_init_uV);
 	if (!ret) {
 		dev_err(td->dev, "couldn't get initialized voltage\n");
-		return ret;
+		return -EINVAL;
 	}
 
 	ret = read_dt_param(td, "nvidia,pwm-period-nanoseconds", &pwm_period);
 	if (!ret) {
 		dev_err(td->dev, "couldn't get PWM period\n");
-		return ret;
+		return -EINVAL;
 	}
 	td->pwm_rate = (NSEC_PER_SEC / pwm_period) * (MAX_DFLL_VOLTAGES - 1);
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 4 lines · Nicolin Chen

Return values from read_dt_param() will be either TRUE (1) or FALSE (0), while dfll_fetch_pwm_params() returns 0 on success or an ERR code on failure.

Quoted 8 lines

So this patch fixes the bug of returning 0 on failure.

Fixes 36541f0499fe ("clk: tegra: dfll: support PWM regulator control")
---
 drivers/clk/tegra/clk-dfll.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Mike, Stephen,

if you don't mind, I'll pick this up in the Tegra tree since there are a few other Tegra clock patches on the list that may require coordination inside the Tegra tree.

Thierry

#2 lore raw
Quoted 14 lines · Thierry Reding
Quoted 4 lines · Nicolin Chen

Return values from read_dt_param() will be either TRUE (1) or FALSE (0), while dfll_fetch_pwm_params() returns 0 on success or an ERR code on failure.

Quoted 8 lines

So this patch fixes the bug of returning 0 on failure.

Fixes 36541f0499fe ("clk: tegra: dfll: support PWM regulator control")
---
 drivers/clk/tegra/clk-dfll.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 5 lines

Mike, Stephen,

if you don't mind, I'll pick this up in the Tegra tree since there are a few other Tegra clock patches on the list that may require coordination inside the Tegra tree.

Also, I do plan on sending the collected set of patches to you for inclusion via PR at a later date, if that's okay with you.

Thierry

maintainer
#3 lore raw

Quoting Thierry Reding (2020-11-20 08:18:39)

Quoted 15 lines · Thierry Reding
Quoted 14 lines · Nicolin Chen
Quoted 12 lines

Return values from read_dt_param() will be either TRUE (1) or FALSE (0), while dfll_fetch_pwm_params() returns 0 on success or an ERR code on failure.

So this patch fixes the bug of returning 0 on failure.

Fixes 36541f0499fe ("clk: tegra: dfll: support PWM regulator control")
---
 drivers/clk/tegra/clk-dfll.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 9 lines
Quoted 5 lines

Mike, Stephen,

if you don't mind, I'll pick this up in the Tegra tree since there are a few other Tegra clock patches on the list that may require coordination inside the Tegra tree.

Also, I do plan on sending the collected set of patches to you for inclusion via PR at a later date, if that's okay with you.

Ok sure.