regulator: ab8500 - fix off-by-one value range checking for selector
[pandora-kernel.git] / drivers / regulator / ab8500.c
index 3d09580..28c7ae6 100644 (file)
@@ -157,7 +157,7 @@ static int ab8500_list_voltage(struct regulator_dev *rdev, unsigned selector)
        if (info->fixed_uV)
                return info->fixed_uV;
 
-       if (selector > info->voltages_len)
+       if (selector >= info->voltages_len)
                return -EINVAL;
 
        return info->supported_voltages[selector];