nb/intel/gm45/northbridge.c: Check for NULL pointers

Change-Id: Ic12a8c145d6348086f9931af93ce6d3b3dcb9039
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/29688
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Arthur Heymans 2018-11-19 13:08:01 +01:00 committed by Felix Held
parent 9651058c42
commit 48fa9225ca
1 changed files with 12 additions and 3 deletions

View File

@ -228,14 +228,23 @@ u32 northbridge_get_tseg_base(void)
u32 northbridge_get_tseg_size(void)
{
const u8 esmramc = pci_read_config8(dev_find_slot(0, PCI_DEVFN(0, 0)),
D0F0_ESMRAMC);
struct device *dev = dev_find_slot(0, PCI_DEVFN(0, 0));
if (dev == NULL)
die("could not find pci 00:00.0!\n");
const u8 esmramc = pci_read_config8(dev, D0F0_ESMRAMC);
return decode_tseg_size(esmramc) << 10;
}
void northbridge_write_smram(u8 smram)
{
pci_write_config8(dev_find_slot(0, PCI_DEVFN(0, 0)), D0F0_SMRAM, smram);
struct device *dev = dev_find_slot(0, PCI_DEVFN(0, 0));
if (dev == NULL)
die("could not find pci 00:00.0!\n");
pci_write_config8(dev, D0F0_SMRAM, smram);
}
/*