Skip to contentSkip to conversation

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

PATCH Applied Axel Lin 2 participants 2 messages Jul 31, 2012 – Aug 1, 2012

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/regulator/wm831x-ldo.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/regulator/wm831x-ldo.c +4 -0
index 5cb70ca..56a6de3 100644
@@ -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;
 
Signature · 1 line
1.7.9.5
Applied
#1 lore raw
Quoted 2 lines · Axel Lin

wm831x_reg_read() returns negative error code on failure. This prevents using the error code as the value read.

Applied, thanks.