summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/wm831x-ldo.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-07-31 21:28:26 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-08-28 11:00:25 -0700
commit363506cd71a5cafeee67b236112f1baf8c30b0ea (patch)
tree3fa3b6aa6e7d580cb95b1f3f89884976c91c81f4 /drivers/regulator/wm831x-ldo.c
parent7c7475c009260d02d56f940816bb7c86fce1542e (diff)
downloadop-kernel-dev-363506cd71a5cafeee67b236112f1baf8c30b0ea.zip
op-kernel-dev-363506cd71a5cafeee67b236112f1baf8c30b0ea.tar.gz
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: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/wm831x-ldo.c')
-rw-r--r--drivers/regulator/wm831x-ldo.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c
index 5cb70ca..56a6de3 100644
--- a/drivers/regulator/wm831x-ldo.c
+++ b/drivers/regulator/wm831x-ldo.c
@@ -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;
@@ -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;
OpenPOWER on IntegriCloud