firmware: Add VB2_TRY() helper macro

Add variadic macro VB2_TRY() to vboot2 APIs, which supports the
following usage:

- VB2_TRY(func_call())
- VB2_TRY(func_call(), ctx, recovery_reason)

and will return the error code if func_call() failed.

Also utilize the macro whenever possible throughout vboot.

BRANCH=none
BUG=chromium:1049032
TEST=make runtests
TEST=emerge-nami coreboot coreboot-utils depthcharge -j

Cq-Depend: chromium:2115423, chromium:2125616, chrome-internal:2817320
Change-Id: Ie5532a8beaa9372fa6fde0a68bda5ecb640087c4
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2084062
Reviewed-by: Julius Werner <jwerner@chromium.org>
17 files changed