summaryrefslogtreecommitdiff
path: root/src/vendorcode/amd/agesa/f12
diff options
context:
space:
mode:
authorJacob Garber <jgarber1@ualberta.ca>2019-07-12 10:34:06 -0600
committerPatrick Georgi <pgeorgi@google.com>2019-07-19 09:57:54 +0000
commit4c33a3aaa38c94b103c51aa6a5553a4b1355c435 (patch)
tree57b215944720d992ea1ded6bdd774d79411a687f /src/vendorcode/amd/agesa/f12
parent78107939de6e2c4b66de6bd1370607f7d3a600f0 (diff)
src: Make implicit fall throughs explicit
Implicit fall throughs are a perpetual source of bugs and Coverity Scan issues, so let's squash them once and for all. GCC can flag implicit fall throughs using the -Wimplicit-fallthrough warning, and this should ensure no more enter the code base. However, many fall throughs are intentional, and we can use the following comment style to have GCC suppress the warning. switch (x) { case 1: y += 1; /* fall through */ case 2: y += 2; /* fall through - but this time with an explanation */ default: y += 3; } This patch adds comments for all remaining intentional fall throughs, and tweaks some existing fall through comments to fit the syntax that GCC expects. Change-Id: I1d75637a434a955a58d166ad203e49620d7395ed Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Reviewed-on: https://review.coreboot.org/c/coreboot/+/34297 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
Diffstat (limited to 'src/vendorcode/amd/agesa/f12')
-rw-r--r--src/vendorcode/amd/agesa/f12/Proc/CPU/S3.c32
-rw-r--r--src/vendorcode/amd/agesa/f12/Proc/Mem/Main/muc.c6
-rw-r--r--src/vendorcode/amd/agesa/f12/Proc/Mem/NB/mnphy.c9
3 files changed, 21 insertions, 26 deletions
diff --git a/src/vendorcode/amd/agesa/f12/Proc/CPU/S3.c b/src/vendorcode/amd/agesa/f12/Proc/CPU/S3.c
index caf817ef33..0897123aa2 100644
--- a/src/vendorcode/amd/agesa/f12/Proc/CPU/S3.c
+++ b/src/vendorcode/amd/agesa/f12/Proc/CPU/S3.c
@@ -225,25 +225,25 @@ SaveDeviceContext (
switch (Device.CommonDeviceHeader->Type) {
case DEV_TYPE_PCI_PRE_ESR:
SavePciDevice (StdHeader, Device.PciDevice, CallPoint, &OrMask);
- // Fall through to advance the pointer after saving context
+ // fall through - advance the pointer after saving context
case DEV_TYPE_PCI:
Device.PciDevice++;
break;
case DEV_TYPE_CPCI_PRE_ESR:
SaveConditionalPciDevice (StdHeader, Device.CPciDevice, CallPoint, &OrMask);
- // Fall through to advance the pointer after saving context
+ // fall through - advance the pointer after saving context
case DEV_TYPE_CPCI:
Device.CPciDevice++;
break;
case DEV_TYPE_MSR_PRE_ESR:
SaveMsrDevice (StdHeader, Device.MsrDevice, CallPoint, (UINT64 **) &OrMask);
- // Fall through to advance the pointer after saving context
+ // fall through - advance the pointer after saving context
case DEV_TYPE_MSR:
Device.MsrDevice++;
break;
case DEV_TYPE_CMSR_PRE_ESR:
SaveConditionalMsrDevice (StdHeader, Device.CMsrDevice, CallPoint, (UINT64 **) &OrMask);
- // Fall through to advance the pointer after saving context
+ // fall through - advance the pointer after saving context
case DEV_TYPE_CMSR:
Device.CMsrDevice++;
break;
@@ -256,25 +256,25 @@ SaveDeviceContext (
switch (Device.CommonDeviceHeader->Type) {
case DEV_TYPE_PCI:
SavePciDevice (StdHeader, Device.PciDevice, CallPoint, &OrMask);
- // Fall through to advance the pointer after saving context
+ // fall through - advance the pointer after saving context
case DEV_TYPE_PCI_PRE_ESR:
Device.PciDevice++;
break;
case DEV_TYPE_CPCI:
SaveConditionalPciDevice (StdHeader, Device.CPciDevice, CallPoint, &OrMask);
- // Fall through to advance the pointer after saving context
+ // fall through - advance the pointer after saving context
case DEV_TYPE_CPCI_PRE_ESR:
Device.CPciDevice++;
break;
case DEV_TYPE_MSR:
SaveMsrDevice (StdHeader, Device.MsrDevice, CallPoint, (UINT64 **) &OrMask);
- // Fall through to advance the pointer after saving context
+ // fall through - advance the pointer after saving context
case DEV_TYPE_MSR_PRE_ESR:
Device.MsrDevice++;
break;
case DEV_TYPE_CMSR:
SaveConditionalMsrDevice (StdHeader, Device.CMsrDevice, CallPoint, (UINT64 **) &OrMask);
- // Fall through to advance the pointer after saving context
+ // fall through - advance the pointer after saving context
case DEV_TYPE_CMSR_PRE_ESR:
Device.CMsrDevice++;
break;
@@ -679,25 +679,25 @@ RestorePreESRContext (
switch (Device.CommonDeviceHeader->Type) {
case DEV_TYPE_PCI_PRE_ESR:
RestorePciDevice (StdHeader, Device.PciDevice, CallPoint, OrMaskPtr);
- // Fall through to advance the pointer after restoring context
+ // fall through - advance the pointer after restoring context
case DEV_TYPE_PCI:
Device.PciDevice++;
break;
case DEV_TYPE_CPCI_PRE_ESR:
RestoreConditionalPciDevice (StdHeader, Device.CPciDevice, CallPoint, OrMaskPtr);
- // Fall through to advance the pointer after restoring context
+ // fall through - advance the pointer after restoring context
case DEV_TYPE_CPCI:
Device.CPciDevice++;
break;
case DEV_TYPE_MSR_PRE_ESR:
RestoreMsrDevice (StdHeader, Device.MsrDevice, CallPoint, (UINT64 **) OrMaskPtr);
- // Fall through to advance the pointer after restoring context
+ // fall through - advance the pointer after restoring context
case DEV_TYPE_MSR:
Device.MsrDevice++;
break;
case DEV_TYPE_CMSR_PRE_ESR:
RestoreConditionalMsrDevice (StdHeader, Device.CMsrDevice, CallPoint, (UINT64 **) OrMaskPtr);
- // Fall through to advance the pointer after restoring context
+ // fall through - advance the pointer after restoring context
case DEV_TYPE_CMSR:
Device.CMsrDevice++;
break;
@@ -739,25 +739,25 @@ RestorePostESRContext (
switch (Device.CommonDeviceHeader->Type) {
case DEV_TYPE_PCI:
RestorePciDevice (StdHeader, Device.PciDevice, CallPoint, &OrMaskPtr);
- // Fall through to advance the pointer after restoring context
+ // fall through - advance the pointer after restoring context
case DEV_TYPE_PCI_PRE_ESR:
Device.PciDevice++;
break;
case DEV_TYPE_CPCI:
RestoreConditionalPciDevice (StdHeader, Device.CPciDevice, CallPoint, &OrMaskPtr);
- // Fall through to advance the pointer after restoring context
+ // fall through - advance the pointer after restoring context
case DEV_TYPE_CPCI_PRE_ESR:
Device.CPciDevice++;
break;
case DEV_TYPE_MSR:
RestoreMsrDevice (StdHeader, Device.MsrDevice, CallPoint, (UINT64 **) &OrMaskPtr);
- // Fall through to advance the pointer after restoring context
+ // fall through - advance the pointer after restoring context
case DEV_TYPE_MSR_PRE_ESR:
Device.MsrDevice++;
break;
case DEV_TYPE_CMSR:
RestoreConditionalMsrDevice (StdHeader, Device.CMsrDevice, CallPoint, (UINT64 **) &OrMaskPtr);
- // Fall through to advance the pointer after restoring context
+ // fall through - advance the pointer after restoring context
case DEV_TYPE_CMSR_PRE_ESR:
Device.CMsrDevice++;
break;
diff --git a/src/vendorcode/amd/agesa/f12/Proc/Mem/Main/muc.c b/src/vendorcode/amd/agesa/f12/Proc/Mem/Main/muc.c
index c76d228382..a6d7bb1aff 100644
--- a/src/vendorcode/amd/agesa/f12/Proc/Mem/Main/muc.c
+++ b/src/vendorcode/amd/agesa/f12/Proc/Mem/Main/muc.c
@@ -212,8 +212,7 @@ MemUFillTrainPattern (
break;
case TestPatternJD256B:
k >>= 1;
- // break is not being used here because TestPatternJD256B also need
- // to run TestPatternJD256A sequence.
+ // fall through - TestPatternJD256B also need to run TestPatternJD256A sequence
case TestPatternJD256A:
k >>= 3;
ASSERT (k < sizeof (PatternJD_256));
@@ -221,8 +220,7 @@ MemUFillTrainPattern (
break;
case TestPatternJD1B:
k >>= 1;
- // break is not being used here because TestPatternJD1B also need
- // to run TestPatternJD1A sequence.
+ // fall through - TestPatternJD1B also need to run TestPatternJD1A sequence
case TestPatternJD1A:
k >>= 3;
i = (UINT8) (k >> 3);
diff --git a/src/vendorcode/amd/agesa/f12/Proc/Mem/NB/mnphy.c b/src/vendorcode/amd/agesa/f12/Proc/Mem/NB/mnphy.c
index 08b3a66625..d84e4172ff 100644
--- a/src/vendorcode/amd/agesa/f12/Proc/Mem/NB/mnphy.c
+++ b/src/vendorcode/amd/agesa/f12/Proc/Mem/NB/mnphy.c
@@ -691,8 +691,7 @@ MemNcmnGetSetTrainDlyNb (
} else if (Rank) {
Index += 0x60;
}
- // break is not being used here because AccessRdDqsDly and AccessWrDatDly also need
- // to run AccessPhRecDly sequence.
+ // fall through - AccessRdDqsDly and AccessWrDatDly also need to run AccessPhRecDly sequence
case AccessPhRecDly:
Index += (Byte / 4);
Offset = 8 * (Byte % 4);
@@ -818,8 +817,7 @@ MemNcmnGetSetTrainDlyClientNb (
case AccessRdDqsDly:
case AccessWrDatDly:
Index += (Dimm * 0x100);
- // break is not being used here because AccessRdDqsDly and AccessWrDatDly also need
- // to run AccessPhRecDly sequence.
+ // fall through - AccessRdDqsDly and AccessWrDatDly also need to run AccessPhRecDly sequence
case AccessPhRecDly:
Index += (Byte / 4);
Offset = 8 * (Byte % 4);
@@ -967,8 +965,7 @@ MemNcmnGetSetTrainDlyUnb (
} else if (Rank) {
Index += 0x60;
}
- // break is not being used here because AccessRdDqsDly and AccessWrDatDly also need
- // to run AccessPhRecDly sequence.
+ // fall through - AccessRdDqsDly and AccessWrDatDly also need to run AccessPhRecDly sequence
case AccessPhRecDly:
Index += (Byte / 4);
Offset = 8 * (Byte % 4);