Commit 363506cd authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: wm831x-ldo: Check return value of wm831x_reg_read()

wm831x_reg_read() returns negative error code on failure.
This prevents using the error code as the value read.
Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 7c7475c0
...@@ -205,6 +205,8 @@ static int wm831x_gp_ldo_get_status(struct regulator_dev *rdev) ...@@ -205,6 +205,8 @@ static int wm831x_gp_ldo_get_status(struct regulator_dev *rdev)
/* Is it reporting under voltage? */ /* Is it reporting under voltage? */
ret = wm831x_reg_read(wm831x, WM831X_LDO_UV_STATUS); ret = wm831x_reg_read(wm831x, WM831X_LDO_UV_STATUS);
if (ret < 0)
return ret;
if (ret & mask) if (ret & mask)
return REGULATOR_STATUS_ERROR; return REGULATOR_STATUS_ERROR;
...@@ -469,6 +471,8 @@ static int wm831x_aldo_get_status(struct regulator_dev *rdev) ...@@ -469,6 +471,8 @@ static int wm831x_aldo_get_status(struct regulator_dev *rdev)
/* Is it reporting under voltage? */ /* Is it reporting under voltage? */
ret = wm831x_reg_read(wm831x, WM831X_LDO_UV_STATUS); ret = wm831x_reg_read(wm831x, WM831X_LDO_UV_STATUS);
if (ret < 0)
return ret;
if (ret & mask) if (ret & mask)
return REGULATOR_STATUS_ERROR; return REGULATOR_STATUS_ERROR;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment