diff options
author | Haowen Bai <baihaowen@meizu.com> | 2022-03-15 04:33:10 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-03-15 13:03:51 +0100 |
commit | 8a317e00798ac0893042e63807429ffddce52a34 (patch) | |
tree | 103555731ef7670b68dbfdefe310f30f0895e63c /drivers/regulator/vctrl-regulator.c | |
parent | regulator: rt5190a: Add support for Richtek RT5190A PMIC (diff) | |
download | linux-8a317e00798ac0893042e63807429ffddce52a34.tar.xz linux-8a317e00798ac0893042e63807429ffddce52a34.zip |
regulator: vctrl: Use min() instead of doing it manually
Fix following coccicheck warning:
drivers/regulator/vctrl-regulator.c:188:15-17: WARNING opportunity for max()
Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Link: https://lore.kernel.org/r/1647315190-16139-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/vctrl-regulator.c')
-rw-r--r-- | drivers/regulator/vctrl-regulator.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/regulator/vctrl-regulator.c b/drivers/regulator/vctrl-regulator.c index d2a37978fc3a..aac7be3b33f7 100644 --- a/drivers/regulator/vctrl-regulator.c +++ b/drivers/regulator/vctrl-regulator.c @@ -185,10 +185,7 @@ static int vctrl_set_voltage_sel(struct regulator_dev *rdev, unsigned int next_sel; int delay; - if (selector >= vctrl->vtable[vctrl->sel].ovp_min_sel) - next_sel = selector; - else - next_sel = vctrl->vtable[vctrl->sel].ovp_min_sel; + next_sel = max_t(unsigned int, selector, vctrl->vtable[vctrl->sel].ovp_min_sel); ret = regulator_set_voltage_rdev(rdev->supply->rdev, vctrl->vtable[next_sel].ctrl, |