[U-Boot] Question about uclass_add function

Gan, Yau Wai yau.wai.gan at intel.com
Tue Jul 18 09:23:04 UTC 2017


For Nios II arch_cpu_init_dm, the uclass_first_device_err is called to find the UCLASS_CPU. This happened right after initf_dm during board_init_f. No SPL is involved here.

Tracing through uclass_first_device_err function, I notice that it tries to find the uclass (via uclass_get) but not success. The code is then continue by adding the uclass (via uclass_add).

Inside uclass_add, the code is able to locate memory address for u_boot_list_2_uclass_2_cpu ( which I believe it is doing the job right). However, it then try to init the uclass's dev_head by pointing the next and prev of the doubly linked list to itself.

Upon returning to its caller, it then checks for dev_head is list_empty. This is true and the function return without error code, and a NULL pointer for the devp. This subsequently failed the Nios CPU dm init.

May I consult if the above behavior is expected? What fix is needed if otherwise? Thank you.


More information about the U-Boot mailing list