Skip to content

Commit

Permalink
regulator: Fix check of unsigned return value and transmit errors in …
Browse files Browse the repository at this point in the history
…wm831x_gp_ldo_get_mode()

If ret is unsigned, the checks for negative wm831x_reg_read() return values
are wrong. The error value should be transmitted to its caller, e.g.
wm831x_gp_ldo_get_status() which tests for a negative return value.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
  • Loading branch information
Roel Kluin authored and Liam Girdwood committed Nov 16, 2009
1 parent 60ef66f commit 9a767d4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/regulator/wm831x-ldo.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,18 @@ static unsigned int wm831x_gp_ldo_get_mode(struct regulator_dev *rdev)
struct wm831x *wm831x = ldo->wm831x;
int ctrl_reg = ldo->base + WM831X_LDO_CONTROL;
int on_reg = ldo->base + WM831X_LDO_ON_CONTROL;
unsigned int ret;
int ret;

ret = wm831x_reg_read(wm831x, on_reg);
if (ret < 0)
return 0;
return ret;

if (!(ret & WM831X_LDO1_ON_MODE))
return REGULATOR_MODE_NORMAL;

ret = wm831x_reg_read(wm831x, ctrl_reg);
if (ret < 0)
return 0;
return ret;

if (ret & WM831X_LDO1_LP_MODE)
return REGULATOR_MODE_STANDBY;
Expand Down

0 comments on commit 9a767d4

Please sign in to comment.