HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/40427 )
Change subject: src/device/dram/ddr{2,3}: Rewrire printram(Capacity) ......................................................................
src/device/dram/ddr{2,3}: Rewrire printram(Capacity)
GCC will complain when using '-Wduplicated-branches' option as printram will expaind to nothing. Rewrite it to make gcc happy when '-Wduplicated-branches' is used.
Change-Id: Ice6245db0a209ce970a8d62cba8b7e0cda2c9968 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/device/dram/ddr2.c M src/device/dram/ddr3.c 2 files changed, 7 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/27/40427/1
diff --git a/src/device/dram/ddr2.c b/src/device/dram/ddr2.c index 5319806..bf3f815 100644 --- a/src/device/dram/ddr2.c +++ b/src/device/dram/ddr2.c @@ -522,10 +522,10 @@ 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..de72bb3 100644 --- a/src/device/dram/ddr3.c +++ b/src/device/dram/ddr3.c @@ -162,11 +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]; /* Row address bits */