Skip to content

Commit

Permalink
regulator: core: print error value when constraints are not applied
Browse files Browse the repository at this point in the history
With commit 064d5cd
(regulator: core: Fix the init of DT defined fixed regulators)
We ensure that regulator must be capable of providing it's current
voltage when constraints are used, however adding the return value in
the print is a little more informative to explain the nature of the
failure involved.

So, instead of providing message such as:
smps9: failed to get the current voltage

having error value added to the message such as:
smps9: failed to get the current voltage(-22)

is a little more informative for debugging the error.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Nishanth Menon authored and Mark Brown committed Jun 5, 2014
1 parent 978371c commit 69d5883
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,9 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
rdev->constraints->min_uV == rdev->constraints->max_uV) {
int current_uV = _regulator_get_voltage(rdev);
if (current_uV < 0) {
rdev_err(rdev, "failed to get the current voltage\n");
rdev_err(rdev,
"failed to get the current voltage(%d)\n",
current_uV);
return current_uV;
}
if (current_uV < rdev->constraints->min_uV ||
Expand All @@ -856,8 +858,8 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
rdev->constraints->max_uV);
if (ret < 0) {
rdev_err(rdev,
"failed to apply %duV constraint\n",
rdev->constraints->min_uV);
"failed to apply %duV constraint(%d)\n",
rdev->constraints->min_uV, ret);
return ret;
}
}
Expand Down

0 comments on commit 69d5883

Please sign in to comment.