Re: [PATCH] regulator: core: if voltage scaling fails, restoreoriginal

From: Paul Walmsley
Date: Thu Dec 13 2012 - 00:06:18 EST


On Wed, 12 Dec 2012, Paolo Pisati wrote:

> but inside regulator_set_voltage(), we save the new regulator voltage before
> actually ramping up:
>
> core.c::regulator_set_voltage():
> ...
> regulator->min_uV = min_uV;
> regulator->max_uV = max_uV;
>
> ret = regulator_check_consumers(rdev, &min_uV, &max_uV);
> if (ret < 0)
> goto out2;
>
> ret = _regulator_do_set_voltage(rdev, min_uV, max_uV); <-- ERROR!!!
> if (ret < 0)
> goto out2;
> ...

I'm not too familiar with this code. But isn't this where the bug is,
rather than in that optimization commit you mentioned? Seems to me,
naïvely, that in the above code, regulator->min_uV and regulator->max_uV
should be set only after _regulator_do_set_voltage() succeeds?


- Paul