[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1343741306.6773.1.camel@phoenix>
Date: Tue, 31 Jul 2012 21:28:26 +0800
From: Axel Lin <axel.lin@...il.com>
To: Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@...com>, linux-kernel@...r.kernel.org
Subject: [PATCH] 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@...il.com>
---
drivers/regulator/wm831x-ldo.c | 4 ++++
1 file changed, 4 insertions(+)
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;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists