Martin L Roth has submitted this change. ( https://review.coreboot.org/c/coreboot/+/74779?usp=email )
Change subject: soc/amd/common/block/graphics: Add missing pci_rom_free() ......................................................................
soc/amd/common/block/graphics: Add missing pci_rom_free()
pci_rom_probe() can allocate memory when mapping a CBFS file, so pci_rom_free() should be called before leaving the function.
BUG=b:278264488 TEST=Build and run with additional debug prints added to confirm that data are correctly unmapped
Change-Id: Ie6fbbfd36f0974551befef4d08423a8148e151e7 Signed-off-by: Grzegorz Bernacki bernacki@google.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/74779 Reviewed-by: Karthik Ramasubramanian kramasub@google.com Reviewed-by: Tim Van Patten timvp@google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Himanshu Sahdev himanshu.sahdev@intel.com --- M src/soc/amd/common/block/graphics/graphics.c 1 file changed, 13 insertions(+), 3 deletions(-)
Approvals: build bot (Jenkins): Verified Tim Van Patten: Looks good to me, but someone else must approve Himanshu Sahdev: Looks good to me, but someone else must approve Karthik Ramasubramanian: Looks good to me, approved
diff --git a/src/soc/amd/common/block/graphics/graphics.c b/src/soc/amd/common/block/graphics/graphics.c index d8f3e1f..93f71f9 100644 --- a/src/soc/amd/common/block/graphics/graphics.c +++ b/src/soc/amd/common/block/graphics/graphics.c @@ -157,11 +157,21 @@ return; } rom = pci_rom_probe(dev); - if (rom == NULL) + if (rom == NULL) { + printk(BIOS_ERR, "%s: Unable to find ROM for %s\n", + __func__, dev_path(dev)); + timestamp_add_now(TS_OPROM_COPY_END); return; + } + ram = pci_rom_load(dev, rom); - if (ram == NULL) - return; + if (ram == NULL) { + printk(BIOS_ERR, "%s: Unable to load ROM for %s\n", + __func__, dev_path(dev)); + } + + pci_rom_free(rom); + timestamp_add_now(TS_OPROM_COPY_END); }