* [PATCH] regulator: Set delay to 0 if set_voltage_time_sel callback returns error
@ 2012-02-24 7:17 Axel Lin
2012-02-24 14:51 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2012-02-24 7:17 UTC (permalink / raw)
To: linux-kernel; +Cc: Liam Girdwood, Mark Brown
rdev->desc->ops->set_voltage_time_sel may return negative error code.
Set delay to 0 if we got error.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/core.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index beeeb7f..61448b6 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1892,6 +1892,8 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
old_selector = ret;
delay = rdev->desc->ops->set_voltage_time_sel(rdev,
old_selector, selector);
+ if (delay < 0)
+ delay = 0;
}
if (best_val != INT_MAX) {
--
1.7.5.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] regulator: Set delay to 0 if set_voltage_time_sel callback returns error
2012-02-24 7:17 [PATCH] regulator: Set delay to 0 if set_voltage_time_sel callback returns error Axel Lin
@ 2012-02-24 14:51 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-02-24 14:51 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Liam Girdwood
[-- Attachment #1: Type: text/plain, Size: 345 bytes --]
On Fri, Feb 24, 2012 at 03:17:46PM +0800, Axel Lin wrote:
> delay = rdev->desc->ops->set_voltage_time_sel(rdev,
> old_selector, selector);
> + if (delay < 0)
> + delay = 0;
We should complain if we get an error rather than silently ignore it,
possibly we'll end up returning prior to the ramp finishing which may
break things.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-24 14:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-24 7:17 [PATCH] regulator: Set delay to 0 if set_voltage_time_sel callback returns error Axel Lin
2012-02-24 14:51 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).