From 32c78de8f17369def492ea3ddd785f0cc140af02 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 29 Dec 2011 17:03:20 +0800 Subject: regulator: Fix checking return value of create_regulator create_regulator() returns NULL on fail. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 6cb9d39..e70e15c 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; } -- cgit v1.1