diff options
author | edisonhello <edisonhello@google.com> | 2021-08-02 14:28:50 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-12 08:13:14 +0000 |
commit | 51879dc24aea94851fc28ffc2f68cba1b58f3db8 (patch) | |
tree | 832355c3b26b424b9300c92a9fb2a6b93f28e4c6 /firmware | |
parent | d8de9942e2fdfdf3f1792740cb5419163faff3ea (diff) | |
download | vboot-51879dc24aea94851fc28ffc2f68cba1b58f3db8.tar.gz |
vboot: Remove unnecessary flag unset operationsstabilize-14150.882.Bstabilize-14150.881.Bstabilize-14150.74.Bstabilize-14150.734.Bstabilize-14150.64.Bstabilize-14150.43.Bstabilize-14150.376.Brelease-R94-14150.Brelease-R94-14150.49.B
Since all flags are initialized as 0 in vb2api_init(),
some flag unset operations are not needed.
Edit few comments to make it more accurate.
BUG=none
TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1; \
make -j32 test_setup && make -j32 runtests;
BRANCH=none
Signed-off-by: edisonhello <edisonhello@google.com>
Change-Id: I0129f43342598195800ff671b965100d3d568564
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3066803
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/2lib/2misc.c | 11 | ||||
-rw-r--r-- | firmware/2lib/include/2api.h | 6 |
2 files changed, 6 insertions, 11 deletions
diff --git a/firmware/2lib/2misc.c b/firmware/2lib/2misc.c index 03766b44..efa33a8a 100644 --- a/firmware/2lib/2misc.c +++ b/firmware/2lib/2misc.c @@ -579,10 +579,9 @@ void vb2_fill_dev_boot_flags(struct vb2_context *ctx) { struct vb2_gbb_header *gbb = vb2_get_gbb(ctx); - if (vb2_secdata_fwmp_get_flag(ctx, VB2_SECDATA_FWMP_DEV_DISABLE_BOOT) && - !(gbb->flags & VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON)) - ctx->flags &= ~(uint64_t)VB2_CONTEXT_DEV_BOOT_ALLOWED; - else + if (!vb2_secdata_fwmp_get_flag(ctx, + VB2_SECDATA_FWMP_DEV_DISABLE_BOOT) || + (gbb->flags & VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON)) ctx->flags |= VB2_CONTEXT_DEV_BOOT_ALLOWED; if (vb2_nv_get(ctx, VB2_NV_DEV_BOOT_EXTERNAL) || @@ -590,15 +589,11 @@ void vb2_fill_dev_boot_flags(struct vb2_context *ctx) vb2_secdata_fwmp_get_flag(ctx, VB2_SECDATA_FWMP_DEV_ENABLE_EXTERNAL)) ctx->flags |= VB2_CONTEXT_DEV_BOOT_EXTERNAL_ALLOWED; - else - ctx->flags &= ~(uint64_t)VB2_CONTEXT_DEV_BOOT_EXTERNAL_ALLOWED; if (vb2_nv_get(ctx, VB2_NV_DEV_BOOT_ALTFW) || (gbb->flags & VB2_GBB_FLAG_FORCE_DEV_BOOT_ALTFW) || vb2_secdata_fwmp_get_flag(ctx, VB2_SECDATA_FWMP_DEV_ENABLE_ALTFW)) ctx->flags |= VB2_CONTEXT_DEV_BOOT_ALTFW_ALLOWED; - else - ctx->flags &= ~(uint64_t)VB2_CONTEXT_DEV_BOOT_ALTFW_ALLOWED; } int vb2api_use_short_dev_screen_delay(struct vb2_context *ctx) diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h index 66594035..b973417d 100644 --- a/firmware/2lib/include/2api.h +++ b/firmware/2lib/include/2api.h @@ -242,19 +242,19 @@ enum vb2_context_flags { VB2_CONTEXT_EC_TRUSTED = (1 << 24), /* - * Boot into developer mode is allowed by FWMP and GBB flags. + * Boot into developer mode is allowed by FWMP or GBB flags. */ VB2_CONTEXT_DEV_BOOT_ALLOWED = (1 << 25), /* * Boot into developer mode from external disk is allowed by nvdata, - * FWMP and GBB flags. + * FWMP or GBB flags. */ VB2_CONTEXT_DEV_BOOT_EXTERNAL_ALLOWED = (1 << 26), /* * Boot into developer mode from alternate bootloader is allowed by - * nvdata, FWMP and GBB flags. + * nvdata, FWMP or GBB flags. */ VB2_CONTEXT_DEV_BOOT_ALTFW_ALLOWED = (1 << 27), }; |