regulator: pwm: Fix handling of missing init voltage
authorMark Kettenis <kettenis@openbsd.org>
Sat, 13 May 2017 18:17:05 +0000 (20:17 +0200)
committerSimon Glass <sjg@chromium.org>
Wed, 7 Jun 2017 13:29:19 +0000 (07:29 -0600)
Since priv->init_voltage is an unsigned integer it can never be
negative.  So the current code fails to detect a missing
'regulator-init-microvolt' property and instead misconfigures the
PWM device.  Fix this by making the relevant members of
'struct pwm_regulator_info' signed integers.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
drivers/power/regulator/pwm_regulator.c

index a6c9fccd68e7c16c4340e574f0037d098b03603e..00a7cca7f7ced4b1b23578c52567ad1814279e25 100644 (file)
@@ -32,13 +32,13 @@ struct pwm_regulator_info {
        bool polarity;
        struct udevice *pwm;
        /* initialize voltage of regulator */
-       unsigned int init_voltage;
+       int init_voltage;
        /* the maximum voltage of regulator */
-       unsigned int max_voltage;
+       int max_voltage;
        /* the minimum voltage of regulator */
-       unsigned int min_voltage;
+       int min_voltage;
        /* the current voltage of regulator */
-       unsigned int volt_uV;
+       int volt_uV;
 };
 
 static int pwm_regulator_enable(struct udevice *dev, bool enable)