lkml.org 
[lkml]   [2020]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 1/6] regulator: core: validate selector against linear_min_sel
On Tue, Nov 24, 2020 at 11:14:54AM +0000, Claudiu.Beznea@microchip.com wrote:
> On 24.11.2020 11:36, Jon Hunter wrote:

> > Before doing so, I wanted to ask if that is the correct fix here,
> > because it seems a bit odd that regulator_count_voltages() returns N
> > voltages, but if the min selector value is greater than 0, then actually
> > there are less than N. However, changing the number of voltages
> > supported by the regulator to be N - linear_min_sel does not make sense
> > either because then we need to know the linear_min_sel in order to
> > determine the first valid voltage.

> I would say that a solution would be to have a new helper to retrieve the
> linear_min_sel (e.g. regulator_min_sel()) and use this for all the
> consumers of regulator_list_voltage() and the other APIs that patch
> "regulator: core: validate selector against linear_min_sel" has changed
> (regulator_list_voltage_table(), regulator_set_voltage_time()). With this
> change the loop in find_vdd_map_entry_exact() should be b/w
> regulator_min_sel() and regulator_count_voltages().

We need an incremental fix to return 0 rather than an error for things
below the minimum selector, it's not invalid for there to be holes in
the range of selectors and this is just an example of that. Consumers
need to be able to cope with skipping over values that can't be mapped.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2020-11-24 15:13    [W:0.073 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site