projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
760423d
)
regulator: vctrl: Use min() instead of doing it manually
author
Haowen Bai
<baihaowen@meizu.com>
Tue, 15 Mar 2022 03:33:10 +0000
(11:33 +0800)
committer
Mark Brown
<broonie@kernel.org>
Tue, 15 Mar 2022 12:03:51 +0000
(12:03 +0000)
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>
drivers/regulator/vctrl-regulator.c
patch
|
blob
|
history
diff --git
a/drivers/regulator/vctrl-regulator.c
b/drivers/regulator/vctrl-regulator.c
index
d2a3797
..
aac7be3
100644
(file)
--- 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,