u-boot/include/dm
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
..
platform_data dm: Rename U_BOOT_DEVICE() to U_BOOT_DRVINFO() 2021-01-05 12:26:35 -07:00
acpi.h common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
device_compat.h dm: Don't undefine dev_xxx macros 2020-10-16 09:44:27 -04:00
device-internal.h dm: core: Add warnings to private / platform setters 2021-03-26 17:03:09 +13:00
device.h dm: core: Move flags to device-runtime info 2021-03-26 17:03:09 +13:00
devres.h dm: core: Require users of devres to include the header 2020-02-05 19:33:46 -07:00
fdtaddr.h dm: core: Use const device for the devfdt...() interface 2020-02-05 19:33:45 -07:00
lists.h dm: Rename U_BOOT_DEVICE() to U_BOOT_DRVINFO() 2021-01-05 12:26:35 -07:00
of_access.h dm: add cells_count parameter in *_count_phandle_with_args 2020-10-06 09:07:54 -06:00
of_addr.h dm: Introduce xxx_get_dma_range() 2021-02-18 11:56:25 +01:00
of_extra.h of: extra: Introduce ofnode_phy_is_fixed_link() API 2021-04-15 14:22:17 +05:30
of.h dm: Avoid using #ifdef for CONFIG_OF_LIVE 2020-10-29 14:42:17 -06:00
ofnode.h dm: core: Add helper to compare node names 2021-07-27 10:56:53 +05:30
pci.h dm: treewide: Rename 'platdata' variables to just 'plat' 2020-12-13 16:51:08 -07:00
pinctrl.h cmd: pinmux: update result of do_status 2021-07-23 07:13:25 -04:00
platdata.h dm: core: Drop device_get_by_driver_info() 2021-03-26 17:03:08 +13:00
read.h dm: Introduce xxx_get_dma_range() 2021-02-18 11:56:25 +01:00
root.h dm: core: Adjust uclass setup with of-platdata 2021-03-22 19:23:28 +13:00
simple_bus.h dm: core: Correctly read <ranges> of simple-bus 2021-04-15 14:22:17 +05:30
test.h Prepare v2021.04-rc5 2021-03-29 18:00:21 -04:00
uclass-id.h reboot-mode: add support for reboot mode control 2021-07-23 10:16:39 -04:00
uclass-internal.h dm: core: Add warnings to private / platform setters 2021-03-26 17:03:09 +13:00
uclass.h dm: core: Don't allow uclass use before ready 2021-08-08 11:27:27 -06:00
util.h dm: migrate the dm_warn to use the log macro 2021-08-08 11:27:27 -06:00