regulator: gpio_switch: Fix set_voltage to return selector value
Antti P Miettinen [Fri, 7 Oct 2011 12:18:26 +0000 (15:18 +0300)]
Current regulator_ops interface expects selector value to be returned.
Not doing so results in uninitialized variables used.

Bug 886170

Change-Id: I5b7ca77badbd517f161f8c5c7a92fdf18e1ef7bb
Reviewed-on: http://git-master/r/56661
Reviewed-by: Antti Miettinen <amiettinen@nvidia.com>
Tested-by: Antti Miettinen <amiettinen@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>

Rebase-Id: R2b693750ff84e9f8dadd88a835bc06b66d0a3129

drivers/regulator/gpio-switch-regulator.c

index 02a9bf1..55dd636 100644 (file)
@@ -105,7 +105,7 @@ static int gpio_switch_list_voltage(struct regulator_dev *rdev,
 }
 
 static int gpio_switch_set_voltage(struct regulator_dev *rdev,
-                                   int min_uV, int max_uV)
+                                  int min_uV, int max_uV, unsigned *selector)
 {
        struct gpio_switch_regulator *ri = rdev_get_drvdata(rdev);
        int uV;
@@ -116,7 +116,7 @@ static int gpio_switch_set_voltage(struct regulator_dev *rdev,
                uV = ri->voltages[val] * 1000;
                if (min_uV <= uV && uV <= max_uV) {
                        found = true;
-                       ri->curr_vol_sel = val;
+                       *selector = ri->curr_vol_sel = val;
                        break;
                }
        }