diff options
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r-- | drivers/regulator/core.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 01f7702a805d..98c3a74e9949 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -540,8 +540,8 @@ static void drms_uA_update(struct regulator_dev *rdev) | |||
540 | 540 | ||
541 | err = regulator_check_drms(rdev); | 541 | err = regulator_check_drms(rdev); |
542 | if (err < 0 || !rdev->desc->ops->get_optimum_mode || | 542 | if (err < 0 || !rdev->desc->ops->get_optimum_mode || |
543 | !rdev->desc->ops->get_voltage || !rdev->desc->ops->set_mode); | 543 | !rdev->desc->ops->get_voltage || !rdev->desc->ops->set_mode) |
544 | return; | 544 | return; |
545 | 545 | ||
546 | /* get output voltage */ | 546 | /* get output voltage */ |
547 | output_uV = rdev->desc->ops->get_voltage(rdev); | 547 | output_uV = rdev->desc->ops->get_voltage(rdev); |
@@ -703,10 +703,13 @@ static int set_machine_constraints(struct regulator_dev *rdev, | |||
703 | int cmin = constraints->min_uV; | 703 | int cmin = constraints->min_uV; |
704 | int cmax = constraints->max_uV; | 704 | int cmax = constraints->max_uV; |
705 | 705 | ||
706 | /* it's safe to autoconfigure fixed-voltage supplies */ | 706 | /* it's safe to autoconfigure fixed-voltage supplies |
707 | and the constraints are used by list_voltage. */ | ||
707 | if (count == 1 && !cmin) { | 708 | if (count == 1 && !cmin) { |
708 | cmin = INT_MIN; | 709 | cmin = 1; |
709 | cmax = INT_MAX; | 710 | cmax = INT_MAX; |
711 | constraints->min_uV = cmin; | ||
712 | constraints->max_uV = cmax; | ||
710 | } | 713 | } |
711 | 714 | ||
712 | /* voltage constraints are optional */ | 715 | /* voltage constraints are optional */ |
@@ -2001,8 +2004,8 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, | |||
2001 | if (regulator_desc->name == NULL || regulator_desc->ops == NULL) | 2004 | if (regulator_desc->name == NULL || regulator_desc->ops == NULL) |
2002 | return ERR_PTR(-EINVAL); | 2005 | return ERR_PTR(-EINVAL); |
2003 | 2006 | ||
2004 | if (!regulator_desc->type == REGULATOR_VOLTAGE && | 2007 | if (regulator_desc->type != REGULATOR_VOLTAGE && |
2005 | !regulator_desc->type == REGULATOR_CURRENT) | 2008 | regulator_desc->type != REGULATOR_CURRENT) |
2006 | return ERR_PTR(-EINVAL); | 2009 | return ERR_PTR(-EINVAL); |
2007 | 2010 | ||
2008 | if (!init_data) | 2011 | if (!init_data) |
@@ -2080,6 +2083,10 @@ out: | |||
2080 | 2083 | ||
2081 | scrub: | 2084 | scrub: |
2082 | device_unregister(&rdev->dev); | 2085 | device_unregister(&rdev->dev); |
2086 | /* device core frees rdev */ | ||
2087 | rdev = ERR_PTR(ret); | ||
2088 | goto out; | ||
2089 | |||
2083 | clean: | 2090 | clean: |
2084 | kfree(rdev); | 2091 | kfree(rdev); |
2085 | rdev = ERR_PTR(ret); | 2092 | rdev = ERR_PTR(ret); |