summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-12-29 13:03:20 +0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-29 14:40:19 +0400
commit32c78de8f17369def492ea3ddd785f0cc140af02 (patch)
treed1d57f47ae01b33c929d8425ceb03893d3d6e3ea /drivers/regulator
parentbcda432194fc7c4a2dbe9d7146f00b4b21e66c8c (diff)
downloadlinux-32c78de8f17369def492ea3ddd785f0cc140af02.tar.xz
regulator: Fix checking return value of create_regulator
create_regulator() returns NULL on fail. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 6cb9d399affd..e70e15c4aa28 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -985,9 +985,8 @@ static int set_supply(struct regulator_dev *rdev,
rdev_info(rdev, "supplied by %s\n", rdev_get_name(supply_rdev));
rdev->supply = create_regulator(supply_rdev, &rdev->dev, "SUPPLY");
- if (IS_ERR(rdev->supply)) {
- err = PTR_ERR(rdev->supply);
- rdev->supply = NULL;
+ if (rdev->supply == NULL) {
+ err = -ENOMEM;
return err;
}