!voltage_ranges is tested for too late, allowing warning and undefined
behavior. Fix that.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
int num_ranges, i;
voltage_ranges = of_get_property(np, "voltage-ranges", &num_ranges);
- num_ranges = num_ranges / sizeof(*voltage_ranges) / 2;
if (!voltage_ranges) {
pr_debug("%pOF: voltage-ranges unspecified\n", np);
return 0;
}
+ num_ranges = num_ranges / sizeof(*voltage_ranges) / 2;
if (!num_ranges) {
pr_err("%pOF: voltage-ranges empty\n", np);
return -EINVAL;