History

regulator: pfuze100: add condition check for 'ramp_delay = 0'

Checking for 'ramp_delay = 0' to avoid Coverity warning report.

Robin Gong committed 6 years ago

Commit a7503a91 parent 9ed84d21 file · +6 −3Browse files

Unified · Split

drivers/regulator/pfuze100-regulator.c+6−3
@@ -128,7 +128,7 @@ static int pfuze100_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) · 127 unmodified lines
128128 struct pfuze_chip *pfuze100 = rdev_get_drvdata(rdev);
129129 int id = rdev_get_id(rdev);
130130 bool reg_has_ramp_delay;
131− unsigned int ramp_bits;
131+ unsigned int ramp_bits = 0;
132132 int ret;
133133
134134 switch (pfuze100->chip_id) {
@@ -149,8 +149,11 @@ static int pfuze100_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) · 14 unmodified lines
149149 }
150150
151151 if (reg_has_ramp_delay) {
152− ramp_delay = 12500 / ramp_delay;
153− ramp_bits = (ramp_delay >> 1) - (ramp_delay >> 3);
152+ if (ramp_delay > 0) {
153+ ramp_delay = 12500 / ramp_delay;
154+ ramp_bits = (ramp_delay >> 1) - (ramp_delay >> 3);
155+ }
156+
154157 ret = regmap_update_bits(pfuze100->regmap,
155158 rdev->desc->vsel_reg + 4,
156159 0xc0, ramp_bits << 6);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t