Skip to content

Commit

Permalink
regulator: Fix the logic to ensure new voltage setting in valid range
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
  • Loading branch information
Axel Lin authored and Mark Brown committed Apr 17, 2012
1 parent e816b57 commit f55205f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/regulator/max8997.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,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;
Expand Down

0 comments on commit f55205f

Please sign in to comment.