Skip to content

Commit

Permalink
regulator: wm831x-ldo: Check return value of wm831x_reg_read()
Browse files Browse the repository at this point in the history
wm831x_reg_read() returns negative error code on failure.
This prevents using the error code as the value read.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Axel Lin authored and Mark Brown committed Aug 28, 2012
1 parent 7c7475c commit 363506c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/regulator/wm831x-ldo.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ static int wm831x_gp_ldo_get_status(struct regulator_dev *rdev)

/* Is it reporting under voltage? */
ret = wm831x_reg_read(wm831x, WM831X_LDO_UV_STATUS);
if (ret < 0)
return ret;
if (ret & mask)
return REGULATOR_STATUS_ERROR;

Expand Down Expand Up @@ -469,6 +471,8 @@ static int wm831x_aldo_get_status(struct regulator_dev *rdev)

/* Is it reporting under voltage? */
ret = wm831x_reg_read(wm831x, WM831X_LDO_UV_STATUS);
if (ret < 0)
return ret;
if (ret & mask)
return REGULATOR_STATUS_ERROR;

Expand Down

0 comments on commit 363506c

Please sign in to comment.