regulator: Don't report zero volts for the fixed voltage regulator
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 2 Nov 2011 11:38:45 +0000 (11:38 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 23 Nov 2011 14:03:41 +0000 (14:03 +0000)
If we don't know what voltage the regulator is set to return an error
rather than reporting zero volts.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/fixed.c

index 21ecf212a5227643abcad804c855f699be32f338..ccbead06c8f39a25a947c7cf1bd1220322712018 100644 (file)
@@ -80,7 +80,10 @@ static int fixed_voltage_get_voltage(struct regulator_dev *dev)
 {
        struct fixed_voltage_data *data = rdev_get_drvdata(dev);
 
-       return data->microvolts;
+       if (data->microvolts)
+               return data->microvolts;
+       else
+               return -EINVAL;
 }
 
 static int fixed_voltage_list_voltage(struct regulator_dev *dev,