From: Linus Walleij Date: Wed, 26 Aug 2009 10:54:04 +0000 (+0200) Subject: REGULATOR Handle positive returncode from enable X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=a7433cff9ed8e7982de8e0f210f0325d0f3d1949;p=linux-edison.git 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 Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index dbf27bf028c..744ea1d0b59 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1236,11 +1236,12 @@ static int _regulator_enable(struct regulator_dev *rdev) } else { return -EINVAL; } - } else { + } else if (ret < 0) { printk(KERN_ERR "%s: is_enabled() failed for %s: %d\n", __func__, rdev->desc->name, ret); return ret; } + /* Fallthrough on positive return values - already enabled */ } rdev->use_count++;