[U-Boot] [PATCH 3/4] dm: do not check dm_root before searching in uclass_root

Masahiro YAMADA yamada.m at jp.panasonic.com
Sun Sep 28 17:54:55 CEST 2014


Simon,


2014-09-29 0:17 GMT+09:00 Simon Glass <sjg at chromium.org>:
> Hi Masahiro,
>
> On 28 September 2014 07:52, Masahiro Yamada <yamada.m at jp.panasonic.com> wrote:
>> The function uclass_find() looks for a uclass in the linked
>> list of gd->uclass_root; gd->dm_root has nothing to do with
>> gd->uclass_root.  Remove this confusing code.
>>
>> Signed-off-by: Masahiro Yamada <yamada.m at jp.panasonic.com>
>> ---
>>
>>  drivers/core/uclass.c | 2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
>> index 901b06e..74df613 100644
>> --- a/drivers/core/uclass.c
>> +++ b/drivers/core/uclass.c
>> @@ -23,8 +23,6 @@ struct uclass *uclass_find(enum uclass_id key)
>>  {
>>         struct uclass *uc;
>>
>> -       if (!gd->dm_root)
>> -               return NULL;
>>         /*
>>          * TODO(sjg at chromium.org): Optimise this, perhaps moving the found
>>          * node to the start of the list, or creating a linear array mapping
>
> This came in in commit:
>
>  c910e2e dm: Avoid accessing uclasses before they are ready
>
> Please see that (and the test that was added) for an explanation.


Commit c910e2e says:

dm: Avoid accessing uclasses before they are ready

Don't allow access to uclasses before they have been initialised.



I still don't get it.
The log did not help me because it is not saying 'why'.

What kind problem would happen if this check was dropped?

gd->dm_root is set when the root device is bound.
At the first call of uclass_find(), it is true gd->dm_root is NULL,
but gd->uclass_root is also empty.

This function, anyway, returns NULL.
The behavior is still the same, I think.


-- 
Best Regards
Masahiro Yamada


More information about the U-Boot mailing list