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>
This commit is contained in:
Haowen Bai 2022-03-15 11:33:10 +08:00 committed by Mark Brown
parent 760423dfad
commit 8a317e0079
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -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,