u-boot/drivers/core
Simon Glass 1e9ced28f1 dm: core: Don't allow uclass use before ready
At present it is possible to call uclass_get() before driver model is
inited. In fact this happens on x86 boards which use Intel FSPv1, since
mrccache_get_region() tries to get the SPI flash device very early
during init.

This has always been undefined behaviour. Previously it generally worked,
i.e. returned an error code without crashing, because gd->uclass_root_s
is zeroed and the uclass can be added despite driver model not being
ready, due to the way lists are implemented. With the change to use a
gd->uclass_root pointer, this no-longer works. For example, it causes a
hang on minnowmax.

Fix this by adding a check that driver model is ready when uclass_get() is
called. This function is called in the process of locating any device, so
it is a good place to add the check.

This fixes booting on minnowmax.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 8a715530bb ("dm: core: Allow the uclass list to move")
2021-08-08 11:27:27 -06:00
..
acpi.c dm: core: Use -ENOSPC in acpi_get_path() 2021-04-06 16:33:19 +12:00
device-remove.c Merge branch '2021-02-02-drop-asm_global_data-when-unused' 2021-02-15 10:16:45 -05:00
device.c dm: core: Add logging for DM_SEQ_ALIAS 2021-07-21 10:27:34 -06:00
devres.c dm: core: Access device flags through functions 2021-01-05 12:24:41 -07:00
dump.c dm: core: Check uclass_get() return value when dumping 2021-07-15 18:42:05 -04:00
fdtaddr.c pci: dm: core: Drop DM_PCI check from devfdt_get_addr_pci() 2021-08-05 16:14:36 -04:00
Kconfig Use LIB_UUID with ACPIGEN and FS_BTRFS 2021-07-28 14:27:54 -04:00
lists.c dm: core: Add logging when lists_bind_fdt() fails 2021-01-05 12:24:41 -07:00
Makefile dm: Avoid using #ifdef for CONFIG_OF_LIVE 2020-10-29 14:42:17 -06:00
of_access.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
of_addr.c of: addr: Remove call to dev_count_cells() in of_get_address() 2021-06-05 07:35:34 -06:00
of_extra.c dm: Support lzma in the flashmap 2021-07-21 10:27:34 -06:00
ofnode.c dm: core: Add helper to compare node names 2021-07-27 10:56:53 +05:30
read.c dm: Introduce xxx_get_dma_range() 2021-02-18 11:56:25 +01:00
read_extra.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
regmap.c reset: Avoid a warning in devm_regmap_init() 2021-07-15 18:42:05 -04:00
root.c remove struct uclass_driver::ops 2021-07-06 10:38:03 -06:00
simple-bus.c dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
simple-pm-bus.c simple-pm-bus: Use -ENOSYS for checking missing system call 2021-04-06 16:33:19 +12:00
syscon-uclass.c dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
uclass.c dm: core: Don't allow uclass use before ready 2021-08-08 11:27:27 -06:00
util.c dm: migrate the dm_warn to use the log macro 2021-08-08 11:27:27 -06:00