Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/74164 )
Change subject: board_enable.c: Invert branch for readability ......................................................................
board_enable.c: Invert branch for readability
Just use a early return for a base condition of the function to aid in removing one layer of logic embedding within a branch.
Change-Id: I9bd96d4d077270697c329d7e6cac1d32ed513ed3 Signed-off-by: Edward O'Callaghan quasisec@google.com --- M board_enable.c 1 file changed, 23 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/64/74164/1
diff --git a/board_enable.c b/board_enable.c index 795d0f3..121b211 100644 --- a/board_enable.c +++ b/board_enable.c @@ -2661,7 +2661,6 @@ bool force_boardenable) { const struct board_match *board = NULL; - int ret = 0;
if (vendor && model) { board = board_match_name(vendor, model, false); @@ -2691,16 +2690,17 @@ if (board->max_rom_decode_parallel) max_rom_decode.parallel = board->max_rom_decode_parallel * 1024;
- if (board->enable) { - msg_pinfo("Enabling full flash access for board "%s %s"... ", - board->vendor_name, board->board_name); + if (!board->enable) + return 0;
- ret = board->enable(cfg); - if (ret) - msg_pinfo("FAILED!\n"); - else - msg_pinfo("OK.\n"); - } + msg_pinfo("Enabling full flash access for board "%s %s"... ", + board->vendor_name, board->board_name); + + int ret = board->enable(cfg); + if (ret) + msg_pinfo("FAILED!\n"); + else + msg_pinfo("OK.\n");
return ret; }