From: Roel Kluin Date: Fri, 16 Oct 2009 12:16:15 +0000 (+0200) Subject: regulator: Fix check of unsigned return value and transmit errors in wm831x_gp_ldo_ge... X-Git-Tag: upstream/snapshot3+hdmi~16569^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a767d43fbddb3319dca568df49c48e0d1bb6bd8;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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 Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c index bb61aed..902db56 100644 --- a/drivers/regulator/wm831x-ldo.c +++ b/drivers/regulator/wm831x-ldo.c @@ -175,18 +175,18 @@ static unsigned int wm831x_gp_ldo_get_mode(struct regulator_dev *rdev) struct wm831x *wm831x = ldo->wm831x; int ctrl_reg = ldo->base + WM831X_LDO_CONTROL; int on_reg = ldo->base + WM831X_LDO_ON_CONTROL; - unsigned int ret; + int ret; ret = wm831x_reg_read(wm831x, on_reg); if (ret < 0) - return 0; + return ret; if (!(ret & WM831X_LDO1_ON_MODE)) return REGULATOR_MODE_NORMAL; ret = wm831x_reg_read(wm831x, ctrl_reg); if (ret < 0) - return 0; + return ret; if (ret & WM831X_LDO1_LP_MODE) return REGULATOR_MODE_STANDBY;