diff options
author | Haowen Bai <baihaowen@meizu.com> | 2022-03-15 11:33:10 +0800 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-03-15 12:03:51 +0000 |
commit | 8a317e00798ac0893042e63807429ffddce52a34 (patch) | |
tree | 103555731ef7670b68dbfdefe310f30f0895e63c /drivers/regulator/vctrl-regulator.c | |
parent | 760423dfad53877b468490758fe7ea968ded9402 (diff) |
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, |