summaryrefslogtreecommitdiff
path: root/util/sconfig
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-06-20 14:15:44 +0200
committerPatrick Georgi <pgeorgi@google.com>2021-06-22 04:47:20 +0000
commit6adbfa79aa4885f7d06cd07063db2c84de832629 (patch)
tree6494bb165a918f418e7db6ca459d8cd66575f578 /util/sconfig
parent6e0dd4e4ffd850d48849907c815fbef50092aa17 (diff)
nb/intel/haswell/pcie.c: Avoid needless death
Using `config_of(dev)` to access `dev->chip_info` will make coreboot die if the latter is NULL, which is the case for devices detected at runtime (i.e. not statically declared in the devicetree). Given that the code is designed to work when the PEG config is all-zeroes (devicetree default), dying because `dev->chip_info` is NULL is foolish and unwarranted. Introduce a helper function that returns a pointer to devicetree config when available, and otherwise returns a pointer to a zero-filled static struct. In addition, avoid an out-of-bounds access in the very unlikely case where the device's function is too large. Tested on Asrock B85M Pro4, can now boot when `device pci 01.0 on end` is commented out in its devicetree. Without this commit, it could not. Change-Id: Ia2d3a03da9eab601fb834b0c51a8a51c9ae14c33 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55690 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'util/sconfig')
0 files changed, 0 insertions, 0 deletions