aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2016-02-24 20:48:11 -0500
committerMark Brown <broonie@kernel.org>2016-02-24 20:48:11 -0500
commitece497ae37ecf080eecdc591504a73808aa058e0 (patch)
tree3916429a305fffa197490c50fb12a813df5f5f5b
parentdaad134d66492a9f641163c94510549770b39657 (diff)
parent6333ef46bbe514a8ece6c432aab6bcf8637b2d7c (diff)
Merge branch 'fix/core' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-core
-rw-r--r--drivers/regulator/core.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 3c987d76e684..6ee9ba43fa8f 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1057,18 +1057,18 @@ static int set_machine_constraints(struct regulator_dev *rdev,
1057 1057
1058 ret = machine_constraints_voltage(rdev, rdev->constraints); 1058 ret = machine_constraints_voltage(rdev, rdev->constraints);
1059 if (ret != 0) 1059 if (ret != 0)
1060 goto out; 1060 return ret;
1061 1061
1062 ret = machine_constraints_current(rdev, rdev->constraints); 1062 ret = machine_constraints_current(rdev, rdev->constraints);
1063 if (ret != 0) 1063 if (ret != 0)
1064 goto out; 1064 return ret;
1065 1065
1066 if (rdev->constraints->ilim_uA && ops->set_input_current_limit) { 1066 if (rdev->constraints->ilim_uA && ops->set_input_current_limit) {
1067 ret = ops->set_input_current_limit(rdev, 1067 ret = ops->set_input_current_limit(rdev,
1068 rdev->constraints->ilim_uA); 1068 rdev->constraints->ilim_uA);
1069 if (ret < 0) { 1069 if (ret < 0) {
1070 rdev_err(rdev, "failed to set input limit\n"); 1070 rdev_err(rdev, "failed to set input limit\n");
1071 goto out; 1071 return ret;
1072 } 1072 }
1073 } 1073 }
1074 1074
@@ -1077,21 +1077,20 @@ static int set_machine_constraints(struct regulator_dev *rdev,
1077 ret = suspend_prepare(rdev, rdev->constraints->initial_state); 1077 ret = suspend_prepare(rdev, rdev->constraints->initial_state);
1078 if (ret < 0) { 1078 if (ret < 0) {
1079 rdev_err(rdev, "failed to set suspend state\n"); 1079 rdev_err(rdev, "failed to set suspend state\n");
1080 goto out; 1080 return ret;
1081 } 1081 }
1082 } 1082 }
1083 1083
1084 if (rdev->constraints->initial_mode) { 1084 if (rdev->constraints->initial_mode) {
1085 if (!ops->set_mode) { 1085 if (!ops->set_mode) {
1086 rdev_err(rdev, "no set_mode operation\n"); 1086 rdev_err(rdev, "no set_mode operation\n");
1087 ret = -EINVAL; 1087 return -EINVAL;
1088 goto out;
1089 } 1088 }
1090 1089
1091 ret = ops->set_mode(rdev, rdev->constraints->initial_mode); 1090 ret = ops->set_mode(rdev, rdev->constraints->initial_mode);
1092 if (ret < 0) { 1091 if (ret < 0) {
1093 rdev_err(rdev, "failed to set initial mode: %d\n", ret); 1092 rdev_err(rdev, "failed to set initial mode: %d\n", ret);
1094 goto out; 1093 return ret;
1095 } 1094 }
1096 } 1095 }
1097 1096
@@ -1102,7 +1101,7 @@ static int set_machine_constraints(struct regulator_dev *rdev,
1102 ret = _regulator_do_enable(rdev); 1101 ret = _regulator_do_enable(rdev);
1103 if (ret < 0 && ret != -EINVAL) { 1102 if (ret < 0 && ret != -EINVAL) {
1104 rdev_err(rdev, "failed to enable\n"); 1103 rdev_err(rdev, "failed to enable\n");
1105 goto out; 1104 return ret;
1106 } 1105 }
1107 } 1106 }
1108 1107
@@ -1111,7 +1110,7 @@ static int set_machine_constraints(struct regulator_dev *rdev,
1111 ret = ops->set_ramp_delay(rdev, rdev->constraints->ramp_delay); 1110 ret = ops->set_ramp_delay(rdev, rdev->constraints->ramp_delay);
1112 if (ret < 0) { 1111 if (ret < 0) {
1113 rdev_err(rdev, "failed to set ramp_delay\n"); 1112 rdev_err(rdev, "failed to set ramp_delay\n");
1114 goto out; 1113 return ret;
1115 } 1114 }
1116 } 1115 }
1117 1116
@@ -1119,7 +1118,7 @@ static int set_machine_constraints(struct regulator_dev *rdev,
1119 ret = ops->set_pull_down(rdev); 1118 ret = ops->set_pull_down(rdev);
1120 if (ret < 0) { 1119 if (ret < 0) {
1121 rdev_err(rdev, "failed to set pull down\n"); 1120 rdev_err(rdev, "failed to set pull down\n");
1122 goto out; 1121 return ret;
1123 } 1122 }
1124 } 1123 }
1125 1124
@@ -1127,7 +1126,7 @@ static int set_machine_constraints(struct regulator_dev *rdev,
1127 ret = ops->set_soft_start(rdev); 1126 ret = ops->set_soft_start(rdev);
1128 if (ret < 0) { 1127 if (ret < 0) {
1129 rdev_err(rdev, "failed to set soft start\n"); 1128 rdev_err(rdev, "failed to set soft start\n");
1130 goto out; 1129 return ret;
1131 } 1130 }
1132 } 1131 }
1133 1132
@@ -1136,16 +1135,12 @@ static int set_machine_constraints(struct regulator_dev *rdev,
1136 ret = ops->set_over_current_protection(rdev); 1135 ret = ops->set_over_current_protection(rdev);
1137 if (ret < 0) { 1136 if (ret < 0) {
1138 rdev_err(rdev, "failed to set over current protection\n"); 1137 rdev_err(rdev, "failed to set over current protection\n");
1139 goto out; 1138 return ret;
1140 } 1139 }
1141 } 1140 }
1142 1141
1143 print_constraints(rdev); 1142 print_constraints(rdev);
1144 return 0; 1143 return 0;
1145out:
1146 kfree(rdev->constraints);
1147 rdev->constraints = NULL;
1148 return ret;
1149} 1144}
1150 1145
1151/** 1146/**
@@ -3979,7 +3974,7 @@ unset_supplies:
3979 3974
3980scrub: 3975scrub:
3981 regulator_ena_gpio_free(rdev); 3976 regulator_ena_gpio_free(rdev);
3982 kfree(rdev->constraints); 3977
3983wash: 3978wash:
3984 device_unregister(&rdev->dev); 3979 device_unregister(&rdev->dev);
3985 /* device core frees rdev */ 3980 /* device core frees rdev */