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>
This commit is contained in:
Martin Kepplinger 2017-07-25 16:34:26 +02:00 committed by Martin Roth
parent c319bab3cd
commit 58eb634659
1 changed files with 4 additions and 1 deletions

View File

@ -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);