aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bernacki <bernacki@google.com>2023-04-25 15:37:57 +0000
committerMartin L Roth <gaumless@gmail.com>2023-06-02 21:49:45 +0000
commit4aa31ac3f974df74976ee4f970a90ea14ca617f6 (patch)
tree29a6f06b07a568e1a9b4f2fcb9ea4bbdb58664c5
parente6b4597fefae3e4fd30e66c522e0e57753b03813 (diff)
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>
-rw-r--r--src/soc/amd/common/block/graphics/graphics.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/soc/amd/common/block/graphics/graphics.c b/src/soc/amd/common/block/graphics/graphics.c
index d8f3e1fd86..93f71f9ce9 100644
--- a/src/soc/amd/common/block/graphics/graphics.c
+++ b/src/soc/amd/common/block/graphics/graphics.c
@@ -157,11 +157,21 @@ static void graphics_set_resources(struct device *const dev)
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);
}