From f90e3b9975f0bd9b09b29c50ac5f7bc36c02eeab Mon Sep 17 00:00:00 2001 From: John Zhao Date: Tue, 25 Aug 2020 10:21:01 -0700 Subject: vendorcode/google: Add error handling Coverity detects missing error handling after calling function tlcl_lib_init. This change checks the function tlcl_lib_init return value and handles error properly. Found-by: Coverity CID 1431994 TEST=None Signed-off-by: John Zhao Change-Id: Ib831646b6a231ad57e3bfef85b801b592d572e6a Reviewed-on: https://review.coreboot.org/c/coreboot/+/44777 Tested-by: build bot (Jenkins) Reviewed-by: Caveh Jalali Reviewed-by: Tim Wawrzynczak --- src/vendorcode/google/chromeos/cse_board_reset.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/vendorcode/google/chromeos') diff --git a/src/vendorcode/google/chromeos/cse_board_reset.c b/src/vendorcode/google/chromeos/cse_board_reset.c index 6034f0d14c..65e09aeedb 100644 --- a/src/vendorcode/google/chromeos/cse_board_reset.c +++ b/src/vendorcode/google/chromeos/cse_board_reset.c @@ -9,14 +9,22 @@ #include #include #include +#include void cse_board_reset(void) { + int ret; struct cr50_firmware_version version; /* Initialize TPM and get the cr50 firmware version. */ - tlcl_lib_init(); + ret = tlcl_lib_init(); + if (ret != VB2_SUCCESS) { + printk(BIOS_ERR, "tlcl_lib_init() failed: 0x%x\n", ret); + return; + } + cr50_get_firmware_version(&version); + /* * Cr50 firmware versions 0.[3|4].20 or newer support strap config 0xe where PLTRST from * AP is connected to cr50's PLTRST# signal. So return immediately and trigger a -- cgit v1.2.3