Skip to content

Commit 9a767d4

Browse files
RoelKluinLiam Girdwood
authored andcommitted
regulator: Fix check of unsigned return value and transmit errors in wm831x_gp_ldo_get_mode()
If ret is unsigned, the checks for negative wm831x_reg_read() return values are wrong. The error value should be transmitted to its caller, e.g. wm831x_gp_ldo_get_status() which tests for a negative return value. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
1 parent 60ef66f commit 9a767d4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎drivers/regulator/wm831x-ldo.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,18 @@ static unsigned int wm831x_gp_ldo_get_mode(struct regulator_dev *rdev)
175175
struct wm831x *wm831x = ldo->wm831x;
176176
int ctrl_reg = ldo->base + WM831X_LDO_CONTROL;
177177
int on_reg = ldo->base + WM831X_LDO_ON_CONTROL;
178-
unsigned int ret;
178+
int ret;
179179

180180
ret = wm831x_reg_read(wm831x, on_reg);
181181
if (ret < 0)
182-
return 0;
182+
return ret;
183183

184184
if (!(ret & WM831X_LDO1_ON_MODE))
185185
return REGULATOR_MODE_NORMAL;
186186

187187
ret = wm831x_reg_read(wm831x, ctrl_reg);
188188
if (ret < 0)
189-
return 0;
189+
return ret;
190190

191191
if (ret & WM831X_LDO1_LP_MODE)
192192
return REGULATOR_MODE_STANDBY;

0 commit comments

Comments
 (0)