aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 3700d0953d7..a0195445675 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -794,7 +794,6 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
794 if (ret < 0) { 794 if (ret < 0) {
795 rdev_err(rdev, "failed to apply %duV constraint\n", 795 rdev_err(rdev, "failed to apply %duV constraint\n",
796 rdev->constraints->min_uV); 796 rdev->constraints->min_uV);
797 rdev->constraints = NULL;
798 return ret; 797 return ret;
799 } 798 }
800 } 799 }
@@ -897,7 +896,6 @@ static int set_machine_constraints(struct regulator_dev *rdev,
897 ret = suspend_prepare(rdev, rdev->constraints->initial_state); 896 ret = suspend_prepare(rdev, rdev->constraints->initial_state);
898 if (ret < 0) { 897 if (ret < 0) {
899 rdev_err(rdev, "failed to set suspend state\n"); 898 rdev_err(rdev, "failed to set suspend state\n");
900 rdev->constraints = NULL;
901 goto out; 899 goto out;
902 } 900 }
903 } 901 }
@@ -924,13 +922,15 @@ static int set_machine_constraints(struct regulator_dev *rdev,
924 ret = ops->enable(rdev); 922 ret = ops->enable(rdev);
925 if (ret < 0) { 923 if (ret < 0) {
926 rdev_err(rdev, "failed to enable\n"); 924 rdev_err(rdev, "failed to enable\n");
927 rdev->constraints = NULL;
928 goto out; 925 goto out;
929 } 926 }
930 } 927 }
931 928
932 print_constraints(rdev); 929 print_constraints(rdev);
930 return 0;
933out: 931out:
932 kfree(rdev->constraints);
933 rdev->constraints = NULL;
934 return ret; 934 return ret;
935} 935}
936 936
@@ -2701,6 +2701,7 @@ unset_supplies:
2701 unset_regulator_supplies(rdev); 2701 unset_regulator_supplies(rdev);
2702 2702
2703scrub: 2703scrub:
2704 kfree(rdev->constraints);
2704 device_unregister(&rdev->dev); 2705 device_unregister(&rdev->dev);
2705 /* device core frees rdev */ 2706 /* device core frees rdev */
2706 rdev = ERR_PTR(ret); 2707 rdev = ERR_PTR(ret);