From c046dd02322dfed1db0c25ae310ec59630d8b492 Mon Sep 17 00:00:00 2001 From: Sridhar Siricilla Date: Fri, 30 Oct 2020 11:45:24 +0530 Subject: [PATCH] mb/intel/adlrvp: Replace if-else-if ladder with switch construct The patch replaces if-else-if ladder with switch case for readability purpose. Signed-off-by: Sridhar Siricilla Change-Id: I268db8bc63aaf64d4a91c9a44ef5282154b20a53 Reviewed-on: https://review.coreboot.org/c/coreboot/+/47054 Reviewed-by: Subrata Banik Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/mainboard/intel/adlrvp/memory.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mainboard/intel/adlrvp/memory.c b/src/mainboard/intel/adlrvp/memory.c index d51caf783a..cab4ef93f3 100644 --- a/src/mainboard/intel/adlrvp/memory.c +++ b/src/mainboard/intel/adlrvp/memory.c @@ -72,12 +72,16 @@ const struct mb_cfg *variant_memory_params(void) { int board_id = get_board_id(); - if (board_id == ADL_P_LP4_1 || board_id == ADL_P_LP4_2) + switch (board_id) { + case ADL_P_LP4_1: + case ADL_P_LP4_2: return &lpddr4_mem_config; - else if (board_id == ADL_P_DDR4_1 || board_id == ADL_P_DDR4_2) + case ADL_P_DDR4_1: + case ADL_P_DDR4_2: return &ddr4_mem_config; - else if (board_id == ADL_P_DDR5) + case ADL_P_DDR5: return &ddr5_mem_config; - - die("unsupported board id : 0x%x\n", board_id); + default: + die("unsupported board id : 0x%x\n", board_id); + } }