aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/skylake/igd.c
diff options
context:
space:
mode:
authorMartin Kepplinger <martink@posteo.de>2017-07-25 16:34:26 +0200
committerMartin Roth <martinroth@google.com>2017-07-27 00:01:36 +0000
commit58eb6346594c07ee470e94c3b00885d0c734d167 (patch)
treeb7f74d4fea0b0849bb2bc80d01cbf5d2b79c3261 /src/soc/intel/skylake/igd.c
parentc319bab3cd416d85330774f9974b41fcb49075a7 (diff)
soc/intel/skylake/igd.c: check return value of init_igd_opregion
init_igd_opregion itself is supposed to return cb_err so this adds error handling, just like other implentations of write_acpi_tables do it. this had been found by coverity: *** CID 1378270: Error handling issues (CHECKED_RETURN) /src/soc/intel/skylake/igd.c: 147 in write_acpi_igd_opregion() 141 /* If IGD is disabled, exit here */ 142 if (pci_read_config16(device, PCI_VENDOR_ID) == 0xFFFF) 143 return current; 144 145 printk(BIOS_DEBUG, "ACPI: * IGD OpRegion\n"); 146 opregion = (igd_opregion_t *)current; CID 1378270: Error handling issues (CHECKED_RETURN) Calling "init_igd_opregion" without checking return value (as is done elsewhere 5 out of 6 times). 147 init_igd_opregion(opregion); 148 update_igd_opregion(opregion); 149 current += sizeof(igd_opregion_t); 150 current = acpi_align_current(current); TEST=Built Change-Id: If6f5d53037f093607d89cfe8faf193d55de7f6c4 Found-by: Coverity (CID 1378270: Error handling issues (CHECKED_RETURN)) Signed-off-by: Martin Kepplinger <martink@posteo.de> Reviewed-on: https://review.coreboot.org/20766 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Diffstat (limited to 'src/soc/intel/skylake/igd.c')
-rw-r--r--src/soc/intel/skylake/igd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/soc/intel/skylake/igd.c b/src/soc/intel/skylake/igd.c
index ea4241c64b..dbcbd4d766 100644
--- a/src/soc/intel/skylake/igd.c
+++ b/src/soc/intel/skylake/igd.c
@@ -144,7 +144,10 @@ static unsigned long write_acpi_igd_opregion(device_t device,
printk(BIOS_DEBUG, "ACPI: * IGD OpRegion\n");
opregion = (igd_opregion_t *)current;
- init_igd_opregion(opregion);
+
+ if (init_igd_opregion(opregion) != CB_SUCCESS)
+ return current;
+
update_igd_opregion(opregion);
current += sizeof(igd_opregion_t);
current = acpi_align_current(current);