Skip to contentSkip to conversation

regulator: Fix the logic to ensure new voltage setting in valid range

PATCH Applied Axel Lin 2 participants 2 messages Apr 11, 2012 – Apr 17, 2012 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: Fix the logic to ensure new voltage setting in valid range

I think this is a typo.
To ensure new voltage setting won't greater than desc->max, the equation should be desc->min + desc->step * new_val <= desc->max.

---
 drivers/regulator/max8997.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/max8997.c +1 -1
index db09244..77feeeb 100644
@@ -682,7 +682,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
 		}
 
 		new_val++;
-	} while (desc->min + desc->step + new_val <= desc->max);
+	} while (desc->min + desc->step * new_val <= desc->max);
 
 	new_idx = tmp_idx;
 	new_val = tmp_val;
Signature · 1 line
1.7.5.4
Applied
#1 lore raw
Quoted 3 lines · Axel Lin

I think this is a typo.
To ensure new voltage setting won't greater than desc->max, the equation should be desc->min + desc->step * new_val <= desc->max.

Applied, thanks.