[PATCH v6 00/20] Do not stop uclass iteration on error

Michal Suchanek msuchanek at suse.de
Wed Oct 12 21:57:49 CEST 2022


Hello,

this patch series fixes the simple uclass iterators to be usable for
iterating uclasses even if some devices fail to probe.

Before this series when a probe error happens an error is returned
without any device pointer, and iteration cannot continue to devices
that happen to be after the failing device in the uclass list.

This is rarely expected, nor clearly documented, and for the most part
not useful in any way.

All but the last patch are new in v4 removing problematic iterator use.

v5:

Split off patches that can be applied independently

Fix uclass_foreach_dev_probe, pci_sriov_init, and sysinfo_get to work
after the uclass_first_device_err change.

Document that uclass_first_device_err and uclass_first_device_check can
return non-activated device on error.

Consolidate multiple similar cleanups into one patch.

v6:

Split off the fixups from uclass_*_device_err switch patch.

Thanks

Michal

Michal Suchanek (20):
  dm: core: Fix uclass_probe_all to really probe all devices
  dm: treewide: Do not opencode uclass_probe_all()
  dm: pci: Fix device PCI iteration
  bootstd: Fix listing boot devices
  usb: ether: Fix error handling in usb_ether_init
  stdio: Fix class iteration in stdio_add_devices()
  video: ipuv3: Fix error handling when getting the display
  w1: Fix bus counting in w1_get_bus
  cmd: List all uclass devices regardless of probe error
  dm: treewide: Use uclass_first_device_err when accessing one device
  dm: treewide: Use uclass_next_device_err when accessing second device
  dm: blk: Do not use uclass_next_device_err
  net: eth-uclass: Do not set device on error
  dm: pci: Update error handling in pci_sriov_init
  mpc83xx: gazerbeam: Update sysinfo_get error handling
  dm: core: Switch uclass_foreach_dev_probe to use simple iterator
  dm: core: Switch uclass_*_device_err to use uclass_*_device_check
  dm: core: Non-activated device may be returned from uclass iterators
    that provide error handling
  dm: treewide: Do not use the return value of simple uclass iterator
  dm: core: Do not stop uclass iteration on error

 arch/arm/mach-k3/j721s2_init.c            |  2 +-
 arch/arm/mach-omap2/am33xx/board.c        |  4 +-
 arch/x86/cpu/broadwell/cpu.c              |  4 +-
 arch/x86/cpu/intel_common/cpu.c           |  4 +-
 arch/x86/lib/pinctrl_ich6.c               |  4 +-
 board/atmel/common/mac_eeprom.c           |  2 +-
 board/gdsys/mpc8308/gazerbeam.c           | 12 +++--
 board/intel/cougarcanyon2/cougarcanyon2.c |  4 +-
 boot/bootdev-uclass.c                     |  4 +-
 cmd/adc.c                                 | 20 ++++----
 cmd/demo.c                                | 15 +++---
 cmd/gpio.c                                | 15 ++++--
 cmd/pmic.c                                | 15 +++---
 cmd/regulator.c                           | 13 +++---
 cmd/virtio.c                              |  9 ++--
 common/stdio.c                            | 32 ++++++-------
 drivers/block/blk-uclass.c                | 16 +++----
 drivers/core/uclass.c                     | 56 ++++++++++++-----------
 drivers/cpu/cpu-uclass.c                  | 20 ++------
 drivers/dma/dma-uclass.c                  |  7 ++-
 drivers/gpio/gpio-uclass.c                | 14 +++---
 drivers/mmc/omap_hsmmc.c                  |  2 +-
 drivers/pci/pci-uclass.c                  | 26 ++++-------
 drivers/serial/serial-uclass.c            |  2 +-
 drivers/serial/serial_bcm283x_mu.c        |  2 +-
 drivers/serial/serial_bcm283x_pl011.c     |  2 +-
 drivers/sysreset/sysreset_ast.c           |  2 +-
 drivers/usb/gadget/ether.c                | 11 ++---
 drivers/video/exynos/exynos_fb.c          | 14 ++----
 drivers/video/imx/mxc_ipuv3_fb.c          |  9 ++--
 drivers/video/mali_dp.c                   |  2 +-
 drivers/video/stm32/stm32_dsi.c           |  2 +-
 drivers/video/tegra124/dp.c               |  4 +-
 drivers/virtio/virtio-uclass.c            | 15 +-----
 drivers/w1/w1-uclass.c                    | 29 ++++++------
 include/dm/uclass.h                       | 49 ++++++++++----------
 lib/acpi/acpi_table.c                     |  2 +-
 lib/efi_loader/efi_gop.c                  |  2 +-
 net/eth-uclass.c                          |  6 ++-
 test/boot/bootmeth.c                      |  2 +-
 test/dm/acpi.c                            | 14 +++---
 test/dm/core.c                            | 27 +++--------
 test/dm/devres.c                          |  4 +-
 test/dm/i2c.c                             |  8 ++--
 test/dm/test-fdt.c                        | 46 ++++++++++++++-----
 test/dm/virtio_device.c                   |  8 ++--
 test/dm/virtio_rng.c                      |  2 +-
 test/fuzz/cmd_fuzz.c                      |  2 +-
 test/fuzz/virtio.c                        |  2 +-
 test/test-main.c                          | 11 +----
 50 files changed, 266 insertions(+), 313 deletions(-)

-- 
2.37.3



More information about the U-Boot mailing list