CHROMIUM: BACKPORT: regulator: s5m8767: fix stack corruption.
authorTodd Broch <tbroch@chromium.org>
Tue, 12 Feb 2013 21:27:01 +0000 (13:27 -0800)
committerChromeBot <chrome-bot@google.com>
Tue, 12 Feb 2013 22:52:59 +0000 (14:52 -0800)
This CL fixes same stack corruption identified by the following commit

     commit 3ef303988cfcb35922f550892cf476e861377f0b
     Author: Inderpal Singh <inderpal.singh@linaro.org>
     Date:   Wed Dec 12 08:57:00 2012 +0530

 regulator: s5m8767: Fix probe failure due to stack corruption

Prior to the upstream fix, the failure manifested itself as kernel
Oops.  In CHROMIUM kernel (3.4) it quietly overwrote the i2c register
index to '0' (PMIC_ID) which led to successful return but without
writing the new voltage value.

This changelist mimics the upstream patch and can be dropped once
we've moved to 3.8 kernel.

BUG=chrome-os-partner:16430, chromium-os:38853
TEST=build & boot.  See voltage levels change based on cpufreq.

Signed-off-by: Todd Broch <tbroch@chromium.org>
Change-Id: I620f1a0487f0cce409e9fc223fb964a076e024d1
Reviewed-on: https://gerrit.chromium.org/gerrit/43129
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
drivers/regulator/s5m8767.c

index e1c78e2..3c3ad8d 100644 (file)
@@ -205,7 +205,7 @@ static int s5m8767_reg_is_enabled(struct regulator_dev *rdev)
 {
        struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
        int ret, reg, mask, pattern;
-       u8 val;
+       unsigned int val;
 
        ret = s5m8767_get_register(rdev, &reg, &mask, &pattern);
        if (ret == -EINVAL)
@@ -295,7 +295,7 @@ static int s5m8767_get_voltage_sel(struct regulator_dev *rdev)
        struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
        int reg, mask, ret;
        int reg_id = rdev_get_id(rdev);
-       u8 val;
+       unsigned int val;
 
        ret = s5m8767_get_voltage_register(rdev, &reg);
        if (ret)
@@ -339,7 +339,7 @@ static int s5m8767_set_voltage(struct regulator_dev *rdev,
        const struct s5m_voltage_desc *desc;
        int reg_id = rdev_get_id(rdev);
        int sel, reg, mask, ret;
-       u8 val;
+       unsigned int val;
 
        switch (reg_id) {
        case S5M8767_LDO1 ... S5M8767_LDO28: