Re: [Letux-kernel] [RFC PATCH 0/3] Enable 1GHz support on omap36xx

From: H. Nikolaus Schaller
Date: Tue Sep 10 2019 - 15:26:22 EST


Hi Adam,

> Am 10.09.2019 um 20:51 schrieb H. Nikolaus Schaller <hns@xxxxxxxxxxxxx>:
>
> Hi,
>
>> Am 10.09.2019 um 20:30 schrieb Adam Ford <aford173@xxxxxxxxx>:
>>
>> On Tue, Sep 10, 2019 at 11:59 AM H. Nikolaus Schaller <hns@xxxxxxxxxxxxx> wrote:
>>>

>>
>> I assumed this to be -EINVAL, but I'd be happy to be wrong.
>
> It seems that cat microvolts stringifies the int returned from reading
> the regulator voltage.
>
> Since it is initialized to -EINVAL it returns "-22" as string instead of
> converting into an errno return when reading /sys... So one step is
> missing a proper error check.

Ok, found it in regulator_uV_show().

ret = sprintf(buf, "%d\n", regulator_get_voltage_rdev(rdev));

simply prints the result into a string.

But regulator_get_voltage_rdev() (or _regulator_get_voltage() before v5.3-rc1)
may return errors like -EPROBE_DEFER or -EINVAL or whatever
rdev->desc->ops->get_voltage_sel(rdev) returns.

So this is clearly a bug in regulator_uV_show().

> But that is just a symptom that there is no call to set a good voltage.

That is the next issue to find...

BR,
Nikolaus