aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/s5m8767.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/s5m8767.c')
-rw-r--r--drivers/regulator/s5m8767.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index 58447db15de1..4ca2db059004 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -311,8 +311,7 @@ static int s5m8767_set_voltage(struct regulator_dev *rdev,
311 struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev); 311 struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
312 const struct s5m_voltage_desc *desc; 312 const struct s5m_voltage_desc *desc;
313 int reg_id = rdev_get_id(rdev); 313 int reg_id = rdev_get_id(rdev);
314 int reg, mask, ret; 314 int sel, reg, mask, ret;
315 int i;
316 u8 val; 315 u8 val;
317 316
318 switch (reg_id) { 317 switch (reg_id) {
@@ -333,19 +332,20 @@ static int s5m8767_set_voltage(struct regulator_dev *rdev,
333 332
334 desc = reg_voltage_map[reg_id]; 333 desc = reg_voltage_map[reg_id];
335 334
336 i = s5m8767_convert_voltage_to_sel(desc, min_uV, max_uV); 335 sel = s5m8767_convert_voltage_to_sel(desc, min_uV, max_uV);
337 if (i < 0) 336 if (sel < 0)
338 return i; 337 return sel;
339 338
340 ret = s5m8767_get_voltage_register(rdev, &reg); 339 ret = s5m8767_get_voltage_register(rdev, &reg);
341 if (ret) 340 if (ret)
342 return ret; 341 return ret;
343 342
344 s5m_reg_read(s5m8767->iodev, reg, &val); 343 s5m_reg_read(s5m8767->iodev, reg, &val);
345 val = val & mask; 344 val &= ~mask;
345 val |= sel;
346 346
347 ret = s5m_reg_write(s5m8767->iodev, reg, val); 347 ret = s5m_reg_write(s5m8767->iodev, reg, val);
348 *selector = i; 348 *selector = sel;
349 349
350 return ret; 350 return ret;
351} 351}