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
128 struct pfuze_chip *pfuze100 = rdev_get_drvdata(rdev);128 struct pfuze_chip *pfuze100 = rdev_get_drvdata(rdev);
129 int id = rdev_get_id(rdev);129 int id = rdev_get_id(rdev);
130 bool reg_has_ramp_delay;130 bool reg_has_ramp_delay;
131 unsigned int ramp_bits;131 unsigned int ramp_bits = 0;
132 int ret;132 int ret;
133 133
134 switch (pfuze100->chip_id) {134 switch (pfuze100->chip_id) {
@@ -149,8 +149,11 @@ static int pfuze100_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) · 14 unmodified lines
149 }149 }
150 150
151 if (reg_has_ramp_delay) {151 if (reg_has_ramp_delay) {
152 ramp_delay = 12500 / ramp_delay;152 if (ramp_delay > 0) {
153 ramp_bits = (ramp_delay >> 1) - (ramp_delay >> 3);153 ramp_delay = 12500 / ramp_delay;
154 ramp_bits = (ramp_delay >> 1) - (ramp_delay >> 3);
155 }
156
154 ret = regmap_update_bits(pfuze100->regmap,157 ret = regmap_update_bits(pfuze100->regmap,
155 rdev->desc->vsel_reg + 4,158 rdev->desc->vsel_reg + 4,
156 0xc0, ramp_bits << 6);159 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