* [PATCH v3] regulator: Fix _regulator_get_voltage if get_voltage callback is NULL
@ 2011-05-23 12:08 Axel Lin
2011-05-23 14:33 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2011-05-23 12:08 UTC (permalink / raw)
To: linux-kernel; +Cc: Liam Girdwood, Mark Brown
In the case of get_voltage callback is NULL, current implementation in
_regulator_get_voltage will return -EINVAL.
Also returns proper error if ret is negative value.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/core.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 9493f61..d3e3879 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1886,12 +1886,14 @@ static int _regulator_get_voltage(struct regulator_dev *rdev)
if (sel < 0)
return sel;
ret = rdev->desc->ops->list_voltage(rdev, sel);
- }
- if (rdev->desc->ops->get_voltage)
+ } else if (rdev->desc->ops->get_voltage) {
ret = rdev->desc->ops->get_voltage(rdev);
- else
+ } else {
return -EINVAL;
+ }
+ if (ret < 0)
+ return ret;
return ret - rdev->constraints->uV_offset;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v3] regulator: Fix _regulator_get_voltage if get_voltage callback is NULL
2011-05-23 12:08 [PATCH v3] regulator: Fix _regulator_get_voltage if get_voltage callback is NULL Axel Lin
@ 2011-05-23 14:33 ` Mark Brown
2011-05-24 9:40 ` Liam Girdwood
0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2011-05-23 14:33 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Liam Girdwood
On Mon, May 23, 2011 at 08:08:10PM +0800, Axel Lin wrote:
> In the case of get_voltage callback is NULL, current implementation in
> _regulator_get_voltage will return -EINVAL.
>
> Also returns proper error if ret is negative value.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] regulator: Fix _regulator_get_voltage if get_voltage callback is NULL
2011-05-23 14:33 ` Mark Brown
@ 2011-05-24 9:40 ` Liam Girdwood
0 siblings, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2011-05-24 9:40 UTC (permalink / raw)
To: Mark Brown; +Cc: Axel Lin, linux-kernel@vger.kernel.org
On 23/05/11 15:33, Mark Brown wrote:
> On Mon, May 23, 2011 at 08:08:10PM +0800, Axel Lin wrote:
>> In the case of get_voltage callback is NULL, current implementation in
>> _regulator_get_voltage will return -EINVAL.
>>
>> Also returns proper error if ret is negative value.
>>
>> Signed-off-by: Axel Lin <axel.lin@gmail.com>
>
> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Applied.
Thanks
Liam
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-24 9:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-23 12:08 [PATCH v3] regulator: Fix _regulator_get_voltage if get_voltage callback is NULL Axel Lin
2011-05-23 14:33 ` Mark Brown
2011-05-24 9:40 ` Liam Girdwood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox