REGULATOR Handle positive returncode from enable

This makes _regulator_enable() properly handle the case where
a regulator is already on when you try to enable it. Currently
it will erroneously handle positive return values as an error.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
This commit is contained in:
Linus Walleij 2009-08-26 12:54:04 +02:00 committed by Liam Girdwood
parent 9e108d33ed
commit a7433cff9e
1 changed files with 2 additions and 1 deletions

View File

@ -1236,11 +1236,12 @@ static int _regulator_enable(struct regulator_dev *rdev)
} else { } else {
return -EINVAL; return -EINVAL;
} }
} else { } else if (ret < 0) {
printk(KERN_ERR "%s: is_enabled() failed for %s: %d\n", printk(KERN_ERR "%s: is_enabled() failed for %s: %d\n",
__func__, rdev->desc->name, ret); __func__, rdev->desc->name, ret);
return ret; return ret;
} }
/* Fallthrough on positive return values - already enabled */
} }
rdev->use_count++; rdev->use_count++;