lkml.org 
[lkml]   [2019]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 3/3] regulator: core: make regulator_register() EPROBE_DEFER aware
On Wed, Sep 18, 2019 at 1:18 AM Marco Felsch <m.felsch@pengutronix.de> wrote:
>
> On 19-09-17 17:57, Dmitry Torokhov wrote:
> > On Tue, Sep 17, 2019 at 4:42 PM Marco Felsch <m.felsch@pengutronix.de> wrote:
> > >
> > > Sometimes it can happen that the regulator_of_get_init_data() can't
> > > retrieve the config due to a not probed device the regulator depends on.
> > > Fix that by checking the return value of of_parse_cb() and return
> > > EPROBE_DEFER in such cases.
> >
> > Treating EPROBE_DEFER in a special way is usually wrong.
> > regulator_of_get_init_data() may fail for multiple reasons (no memory,
> > invalid DT, etc, etc). All of them should abort instantiating
> > regulator.
>
> Those errors are handled but the behaviour of this funciton is to return
> NULL in such errors which is fine for the caller of this function. I
> only want to handle EPROBE_DEFER special..

And I am saying it is wrong to handle only EPROBE_DEFER.
regulator_of_get_init_data() should always return ERR_PTR()-encoded
error code when parsing callback returns error, so that regulator core
does not mistakenly believe that there is no configuration/init data
when in fact there is, but we failed to handle it properly.

IOW I'm advocating for extending you patch so that it reads:

+ ret = desc->of_parse_cb(child, desc, config);
+ if (ret) {
+ of_node_put(child);
+ return ERR_PTR(ret);
+ }

Thanks.

--
Dmitry

\
 
 \ /
  Last update: 2019-09-18 17:54    [W:0.049 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site