regulator: wm831x-ldo: Check return value of wm831x_reg_read()
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.
Signed-off-by Axel Lin <[email protected]>
--- drivers/regulator/wm831x-ldo.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/regulator/wm831x-ldo.c +4 -0
@@ -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
Mark Brown
AppliedQuoted 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.