HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/39561 )
Change subject: Treewide: Add '-Wduplicated-branches' warning option ......................................................................
Treewide: Add '-Wduplicated-branches' warning option
Change-Id: Ie433f32a423ce32ea2bd5ae09a1718341cd2b672 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M Makefile.inc M src/device/dram/ddr2.c M src/device/dram/ddr3.c 3 files changed, 7 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/61/39561/1
diff --git a/Makefile.inc b/Makefile.inc index 43b29c7..f5395ce 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -421,7 +421,7 @@ CFLAGS_common += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes CFLAGS_common += -Wwrite-strings -Wredundant-decls -Wno-trigraphs -Wimplicit-fallthrough CFLAGS_common += -Wstrict-aliasing -Wshadow -Wdate-time -Wtype-limits -Wvla -CFLAGS_common += -Wlogical-op -Wduplicated-cond -Wdangling-else +CFLAGS_common += -Wlogical-op -Wduplicated-cond -Wduplicated-branches -Wdangling-else CFLAGS_common += -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer CFLAGS_common += -ffunction-sections -fdata-sections -fno-pie ifeq ($(CONFIG_COMPILER_GCC),y) diff --git a/src/device/dram/ddr2.c b/src/device/dram/ddr2.c index 5319806..9c5cc4f 100644 --- a/src/device/dram/ddr2.c +++ b/src/device/dram/ddr2.c @@ -522,10 +522,9 @@ dimm->ranksize_mb = 128 * reg8; /* Module density */ dimm->size_mb = dimm->ranksize_mb * dimm->ranks; - if (dimm->size_mb < 1024) - printram(" Capacity : %u MB\n", dimm->size_mb); - else - printram(" Capacity : %u GB\n", dimm->size_mb >> 10); + printram(" Capacity : ", (dimm->size_mb < 1024) ? + "%u MB\n", dimm->size_mb : + "%u GB\n", dimm->size_mb >> 10);
/* SDRAM Maximum Cycle Time (tCKmax) */ if (spd_decode_bcd_time(&dimm->tCK, spd[43]) != CB_SUCCESS) { diff --git a/src/device/dram/ddr3.c b/src/device/dram/ddr3.c index bef3c78..f3615b6 100644 --- a/src/device/dram/ddr3.c +++ b/src/device/dram/ddr3.c @@ -162,10 +162,9 @@ printram(" Invalid module capacity\n"); ret = SPD_STATUS_INVALID_FIELD; } - if (capacity_shift < 0x02) { - printram(" Capacity : %u Mb\n", 256 << capacity_shift); - } else { - printram(" Capacity : %u Gb\n", 1 << (capacity_shift - 2)); + printram(" Capacity : ", (capacity_shift < 0x02) ? + "%u Mb\n", 256 << capacity_shift : + "%u Gb\n", 1 << (capacity_shift - 2)); }
reg8 = spd[5];