From 69f6fd4589ee4d7cb0bfa12face26eba1fa0a973 Mon Sep 17 00:00:00 2001 From: Kyösti Mälkki Date: Mon, 21 Jan 2019 14:19:01 +0200 Subject: AGESA/binaryPI: Add NULL pointers check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix regression after commits 4ad7f5b AGESA: Use pcidev_on_root() 33ff44c binaryPI: Use pcidev_on_root() Previously used call dev_find_slot() returned pointers to PCI device nodes that were actually not present in the hardware at all. Register reads would come back with invalid (0xff) values and writes would be ignored. After change to pcidev_on_root(), attempting to do register operations with non-present PCI hardware immediately halts with error get_pbus: dev is NULL! Change-Id: I785350c171a642207c5fab884a953d45a3bfe592 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/31026 Tested-by: build bot (Jenkins) Reviewed-by: Michał Żygowski Reviewed-by: Paul Menzel Reviewed-by: Angel Pons --- src/northbridge/amd/agesa/family16kb/northbridge.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/northbridge/amd/agesa') diff --git a/src/northbridge/amd/agesa/family16kb/northbridge.c b/src/northbridge/amd/agesa/family16kb/northbridge.c index da54fd8052..b283094f07 100644 --- a/src/northbridge/amd/agesa/family16kb/northbridge.c +++ b/src/northbridge/amd/agesa/family16kb/northbridge.c @@ -574,9 +574,11 @@ static void fam16_finalize(void *chip_info) /* disable No Snoop */ dev = pcidev_on_root(1, 1); - value = pci_read_config32(dev, 0x60); - value &= ~(1 << 11); - pci_write_config32(dev, 0x60, value); + if (dev != NULL) { + value = pci_read_config32(dev, 0x60); + value &= ~(1 << 11); + pci_write_config32(dev, 0x60, value); + } } struct chip_operations northbridge_amd_agesa_family16kb_ops = { -- cgit v1.2.3