Attention is currently required from: Angel Pons, Julius Werner, Patrick Rudolph, Felix Held. Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/51498 )
Change subject: Use the fallthrough statement in switch loops ......................................................................
Use the fallthrough statement in switch loops
Clang does not seem to work with 'fall through' inside comments.
Change-Id: Idcbe373be33ef7247548f856bfaba7ceb7f749b5 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/console/vtxprintf.c M src/drivers/aspeed/common/ast_main.c M src/drivers/ipmi/ipmi_kcs_ops.c M src/drivers/ti/sn65dsi86bridge/sn65dsi86bridge.c M src/ec/google/chromeec/ec_acpi.c M src/ec/kontron/kempld/kempld.c M src/lib/edid.c M src/lib/prog_loaders.c M src/mainboard/google/poppy/variants/nami/mainboard.c M src/mainboard/lippert/frontrunner-af/variants/frontrunner-af/BiosCallOuts.c M src/mainboard/lippert/frontrunner-af/variants/toucan-af/BiosCallOuts.c M src/northbridge/intel/sandybridge/raminit_mrc.c M src/soc/nvidia/tegra124/sor.c M src/soc/nvidia/tegra210/sor.c M src/soc/rockchip/rk3288/sdram.c M src/southbridge/amd/agesa/hudson/hudson.c M src/southbridge/amd/agesa/hudson/lpc.c M src/southbridge/amd/cimx/sb800/lpc.c M src/southbridge/amd/pi/hudson/lpc.c M src/superio/nuvoton/nct5104d/superio.c 20 files changed, 65 insertions(+), 40 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/98/51498/1
diff --git a/src/console/vtxprintf.c b/src/console/vtxprintf.c index 2a51430..998a0a8 100644 --- a/src/console/vtxprintf.c +++ b/src/console/vtxprintf.c @@ -4,6 +4,7 @@ * vtxprintf.c, originally from linux/lib/vsprintf.c */
+#include <commonlib/bsd/compiler.h> #include <console/vtxprintf.h> #include <ctype.h> #include <string.h> @@ -244,7 +245,7 @@
case 'X': flags |= LARGE; - /* fall through */ + fallthrough; case 'x': base = 16; break; @@ -252,6 +253,7 @@ case 'd': case 'i': flags |= SIGN; + fallthrough; case 'u': break;
diff --git a/src/drivers/aspeed/common/ast_main.c b/src/drivers/aspeed/common/ast_main.c index 30d1131..9ebd157 100644 --- a/src/drivers/aspeed/common/ast_main.c +++ b/src/drivers/aspeed/common/ast_main.c @@ -213,7 +213,7 @@ ast->dp501_fw_addr = NULL; } } - /* fallthrough */ + fallthrough; case 0x0c: ast->tx_chip_type = AST_TX_DP501; } diff --git a/src/drivers/ipmi/ipmi_kcs_ops.c b/src/drivers/ipmi/ipmi_kcs_ops.c index 9d1cac8..063c08e 100644 --- a/src/drivers/ipmi/ipmi_kcs_ops.c +++ b/src/drivers/ipmi/ipmi_kcs_ops.c @@ -10,6 +10,7 @@
#include <arch/io.h> #include <bootstate.h> +#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <device/device.h> #include <device/gpio.h> @@ -247,7 +248,7 @@ break; default: printk(BIOS_ERR, "IPMI: Unsupported register spacing for SPMI\n"); - /* fall through */ + fallthrough; case 1: addr.bit_offset = 8; break; @@ -369,7 +370,7 @@ break; default: printk(BIOS_ERR, "IPMI: Unsupported register spacing for SMBIOS\n"); - /* fall through */ + fallthrough; case 1: register_spacing = 0 << 6; break; diff --git a/src/drivers/ti/sn65dsi86bridge/sn65dsi86bridge.c b/src/drivers/ti/sn65dsi86bridge/sn65dsi86bridge.c index ca41cdb..88be65d 100644 --- a/src/drivers/ti/sn65dsi86bridge/sn65dsi86bridge.c +++ b/src/drivers/ti/sn65dsi86bridge/sn65dsi86bridge.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <delay.h> #include <endian.h> @@ -294,13 +295,13 @@ default: printk(BIOS_ERR, "Unexpected max rate (%#x); assuming 5.4 GHz\n", (int)dpcd_val); - /* fall through */ + fallthrough; case DP_LINK_BW_5_4: rate_valid[7] = 1; - /* fall through */ + fallthrough; case DP_LINK_BW_2_7: rate_valid[4] = 1; - /* fall through */ + fallthrough; case DP_LINK_BW_1_62: rate_valid[1] = 1; break; diff --git a/src/ec/google/chromeec/ec_acpi.c b/src/ec/google/chromeec/ec_acpi.c index bcecd89..db29107 100644 --- a/src/ec/google/chromeec/ec_acpi.c +++ b/src/ec/google/chromeec/ec_acpi.c @@ -5,6 +5,7 @@ #include <acpi/acpigen.h> #include <acpi/acpigen_ps2_keybd.h> #include <acpi/acpigen_usb.h> +#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <drivers/usb/acpi/chip.h> #include <drivers/intel/usb4/retimer/retimer.h> @@ -105,7 +106,8 @@ return "BACK_LEFT"; case EC_PD_PORT_LOCATION_BACK_RIGHT: return "BACK_RIGHT"; - case EC_PD_PORT_LOCATION_UNKNOWN: /* intentional fallthrough */ + case EC_PD_PORT_LOCATION_UNKNOWN: + fallthrough; default: return "UNKNOWN"; } @@ -147,9 +149,10 @@ get_usb_port_references(i, &usb2_port, &usb3_port, &usb4_port);
struct typec_connector_class_config typec_config = { - .power_role = port_caps.power_role_cap, - .try_power_role = port_caps.try_power_role_cap, - .data_role = port_caps.data_role_cap, + .power_role = (enum usb_typec_power_role)port_caps.power_role_cap, + .try_power_role = + (enum usb_typec_try_power_role)port_caps.try_power_role_cap, + .data_role = (enum usb_typec_data_role)port_caps.data_role_cap, .usb2_port = usb2_port, .usb3_port = usb3_port, .usb4_port = usb4_port, diff --git a/src/ec/kontron/kempld/kempld.c b/src/ec/kontron/kempld/kempld.c index f8371a8..5578828 100644 --- a/src/ec/kontron/kempld/kempld.c +++ b/src/ec/kontron/kempld/kempld.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <device/device.h>
@@ -82,13 +83,13 @@ dev->ops = &kempld_uart_ops; break; } - /* Fall through. */ + fallthrough; case 1: if (dev->path.generic.subid == 0) { kempld_i2c_device_init(dev); break; } - /* Fall through. */ + fallthrough; default: printk(BIOS_WARNING, "KEMPLD: Spurious device %s.\n", dev_path(dev)); break; diff --git a/src/lib/edid.c b/src/lib/edid.c index cd7a47a..93b5603 100644 --- a/src/lib/edid.c +++ b/src/lib/edid.c @@ -7,6 +7,7 @@ */
#include <assert.h> +#include <commonlib/bsd/compiler.h> #include <commonlib/helpers.h> #include <console/console.h> #include <ctype.h> @@ -1183,13 +1184,13 @@ switch (edid[0x13]) { case 4: c.claims_one_point_four = 1; - /* fall through */ + fallthrough; case 3: c.claims_one_point_three = 1; - /* fall through */ + fallthrough; case 2: c.claims_one_point_two = 1; - /* fall through */ + fallthrough; default: c.claims_one_point_oh = 1; } diff --git a/src/lib/prog_loaders.c b/src/lib/prog_loaders.c index 4722e54..59dfc3a 100644 --- a/src/lib/prog_loaders.c +++ b/src/lib/prog_loaders.c @@ -4,6 +4,7 @@ #include <stdlib.h> #include <cbfs.h> #include <cbmem.h> +#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <fallback.h> #include <halt.h> @@ -170,7 +171,8 @@ if (CONFIG(PAYLOAD_FIT_SUPPORT)) { fit_payload(payload); break; - } /* else fall-through */ + } + fallthrough; default: die_with_post_code(POST_INVALID_ROM, "Unsupported payload type.\n"); diff --git a/src/mainboard/google/poppy/variants/nami/mainboard.c b/src/mainboard/google/poppy/variants/nami/mainboard.c index 1387716..4b6927e 100644 --- a/src/mainboard/google/poppy/variants/nami/mainboard.c +++ b/src/mainboard/google/poppy/variants/nami/mainboard.c @@ -5,6 +5,7 @@ #include <baseboard/variants.h> #include <cbfs.h> #include <chip.h> +#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <device/device.h> #include <drivers/intel/gma/opregion.h> @@ -241,7 +242,7 @@ case SKU_6_SYNDRA: case SKU_7_SYNDRA: pl2_id = PL2_ID_SONA_SYNDRA; - /* fallthrough */ + fallthrough; case SKU_0_VAYNE: case SKU_1_VAYNE: case SKU_2_VAYNE: diff --git a/src/mainboard/lippert/frontrunner-af/variants/frontrunner-af/BiosCallOuts.c b/src/mainboard/lippert/frontrunner-af/variants/frontrunner-af/BiosCallOuts.c index b2a96a2..18f9703 100644 --- a/src/mainboard/lippert/frontrunner-af/variants/frontrunner-af/BiosCallOuts.c +++ b/src/mainboard/lippert/frontrunner-af/variants/frontrunner-af/BiosCallOuts.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */
#include <AGESA.h> +#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <northbridge/amd/agesa/BiosCallOuts.h> #include <SB800.h> @@ -38,7 +39,7 @@ case VOLT1_25: // board is not able to provide this MemData->ParameterListPtr->DDR3Voltage = VOLT1_35; // sorry printk(BIOS_INFO, "can't provide 1.25 V, using "); - // fall through + fallthrough; default: // AGESA.h says in mixed case 1.5V DIMMs get excluded case VOLT1_35: FCH_GPIO(184) = 0x08; // = output, disable PU, set to 0 diff --git a/src/mainboard/lippert/frontrunner-af/variants/toucan-af/BiosCallOuts.c b/src/mainboard/lippert/frontrunner-af/variants/toucan-af/BiosCallOuts.c index 4861809..51d8c14 100644 --- a/src/mainboard/lippert/frontrunner-af/variants/toucan-af/BiosCallOuts.c +++ b/src/mainboard/lippert/frontrunner-af/variants/toucan-af/BiosCallOuts.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */
#include <AGESA.h> +#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <northbridge/amd/agesa/BiosCallOuts.h> #include <SB800.h> @@ -39,7 +40,7 @@ case VOLT1_25: // board is not able to provide this MemData->ParameterListPtr->DDR3Voltage = VOLT1_35; // sorry printk(BIOS_INFO, "can't provide 1.25 V, using "); - // fall through + fallthrough; default: // AGESA.h says in mixed case 1.5V DIMMs get excluded case VOLT1_35: FCH_GPIO(65) = 0x08; // = output, disable PU, set to 0 diff --git a/src/northbridge/intel/sandybridge/raminit_mrc.c b/src/northbridge/intel/sandybridge/raminit_mrc.c index 149860d..d43a85e 100644 --- a/src/northbridge/intel/sandybridge/raminit_mrc.c +++ b/src/northbridge/intel/sandybridge/raminit_mrc.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <console/usb.h> #include <cf9_reset.h> @@ -271,7 +272,7 @@ /* MRC only supports fixed numbers of frequencies */ default: printk(BIOS_WARNING, "RAMINIT: Limiting DDR3 clock to 800 Mhz\n"); - /* fallthrough */ + fallthrough; case 400: pei_data->max_ddr3_freq = 800; break; diff --git a/src/soc/nvidia/tegra124/sor.c b/src/soc/nvidia/tegra124/sor.c index 2cf16b0..6b111dd 100644 --- a/src/soc/nvidia/tegra124/sor.c +++ b/src/soc/nvidia/tegra124/sor.c @@ -5,6 +5,7 @@ */
#include <boot/tables.h> +#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <delay.h> #include <device/device.h> @@ -220,10 +221,10 @@ case 4: reg_val |= (NV_SOR_DP_PADCTL_PD_TXD_3_NO | NV_SOR_DP_PADCTL_PD_TXD_2_NO); - /* fall through */ + fallthrough; case 2: reg_val |= NV_SOR_DP_PADCTL_PD_TXD_1_NO; - /* fall through */ + fallthrough; case 1: reg_val |= NV_SOR_DP_PADCTL_PD_TXD_0_NO; break; @@ -893,10 +894,10 @@ case 4: val |= (NV_SOR_DP_PADCTL_PD_TXD_3_NO | NV_SOR_DP_PADCTL_PD_TXD_2_NO); - /* fall through */ + fallthrough; case 2: val |= NV_SOR_DP_PADCTL_PD_TXD_1_NO; - /* fall through */ + fallthrough; case 1: val |= NV_SOR_DP_PADCTL_PD_TXD_0_NO; break; diff --git a/src/soc/nvidia/tegra210/sor.c b/src/soc/nvidia/tegra210/sor.c index 9b50d93..2e42df5 100644 --- a/src/soc/nvidia/tegra210/sor.c +++ b/src/soc/nvidia/tegra210/sor.c @@ -4,6 +4,7 @@ * drivers/video/tegra/dc/sor.c */
+#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <stdint.h> #include <delay.h> @@ -222,9 +223,10 @@ case 4: reg_val |= (NV_SOR_DP_PADCTL_PD_TXD_3_NO | NV_SOR_DP_PADCTL_PD_TXD_2_NO); - /* fall through */ + fallthrough; case 2: reg_val |= NV_SOR_DP_PADCTL_PD_TXD_1_NO; + fallthrough; case 1: reg_val |= NV_SOR_DP_PADCTL_PD_TXD_0_NO; break; @@ -891,10 +893,10 @@ case 4: val |= (NV_SOR_DP_PADCTL_PD_TXD_3_NO | NV_SOR_DP_PADCTL_PD_TXD_2_NO); - /* fall through */ + fallthrough; case 2: val |= NV_SOR_DP_PADCTL_PD_TXD_1_NO; - /* fall through */ + fallthrough; case 1: val |= NV_SOR_DP_PADCTL_PD_TXD_0_NO; break; diff --git a/src/soc/rockchip/rk3288/sdram.c b/src/soc/rockchip/rk3288/sdram.c index 877f53d..34ebcca 100644 --- a/src/soc/rockchip/rk3288/sdram.c +++ b/src/soc/rockchip/rk3288/sdram.c @@ -1,4 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <commonlib/bsd/compiler.h> #include <device/mmio.h> #include <console/console.h> #include <delay.h> @@ -739,7 +740,7 @@ != PGSR_DLDONE) ; /* if at low power state, need wakeup first, then enter the config */ - /* fall through */ + fallthrough; case ACCESS: case INIT_MEM: write32(&ddr_pctl_regs->sctl, CFG_STATE); @@ -893,7 +894,8 @@ while ((read32(&ddr_pctl_regs->stat) & PCTL_STAT_MSK) != CONF) ; - /* fall through - enter config next to get to access state */ + /* enter config next to get to access state */ + fallthrough; case CONF: write32(&ddr_pctl_regs->sctl, GO_STATE); while ((read32(&ddr_pctl_regs->stat) & PCTL_STAT_MSK) diff --git a/src/southbridge/amd/agesa/hudson/hudson.c b/src/southbridge/amd/agesa/hudson/hudson.c index f1506bc..c4d9cb6 100644 --- a/src/southbridge/amd/agesa/hudson/hudson.c +++ b/src/southbridge/amd/agesa/hudson/hudson.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */
#include <amdblocks/acpimmio.h> +#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <device/mmio.h> #include <device/device.h> @@ -79,7 +80,7 @@ case PCI_DEVFN(0x12, 0): if (dev->enabled == 0) hudson_disable_usb(USB_EN_DEVFN_12_0); - /* fall through */ + fallthrough; case PCI_DEVFN(0x12, 2): if (dev->enabled == 0) hudson_disable_usb(USB_EN_DEVFN_12_2); @@ -87,7 +88,7 @@ case PCI_DEVFN(0x13, 0): if (dev->enabled == 0) hudson_disable_usb(USB_EN_DEVFN_13_0); - /* fall through */ + fallthrough; case PCI_DEVFN(0x13, 2): if (dev->enabled == 0) hudson_disable_usb(USB_EN_DEVFN_13_2); @@ -95,7 +96,7 @@ case PCI_DEVFN(0x16, 0): if (dev->enabled == 0) hudson_disable_usb(USB_EN_DEVFN_16_0); - /* fall through */ + fallthrough; case PCI_DEVFN(0x16, 2): if (dev->enabled == 0) hudson_disable_usb(USB_EN_DEVFN_16_2); diff --git a/src/southbridge/amd/agesa/hudson/lpc.c b/src/southbridge/amd/agesa/hudson/lpc.c index 89c9a6b..ad8b2dc 100644 --- a/src/southbridge/amd/agesa/hudson/lpc.c +++ b/src/southbridge/amd/agesa/hudson/lpc.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */
#include <amdblocks/acpimmio.h> +#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <device/device.h> #include <device/pci.h> @@ -289,10 +290,10 @@ switch (var_num) { case 3: pci_write_config16(dev, 0x90, reg_var[2]); - /* fall through */ + fallthrough; case 2: pci_write_config16(dev, 0x66, reg_var[1]); - /* fall through */ + fallthrough; case 1: pci_write_config16(dev, 0x64, reg_var[0]); break; diff --git a/src/southbridge/amd/cimx/sb800/lpc.c b/src/southbridge/amd/cimx/sb800/lpc.c index a082e0c..ffe030a 100644 --- a/src/southbridge/amd/cimx/sb800/lpc.c +++ b/src/southbridge/amd/cimx/sb800/lpc.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <device/pci.h> #include <device/pci_def.h> @@ -158,10 +159,10 @@ switch (var_num) { case 3: pci_write_config16(dev, 0x90, reg_var[2]); - /* fall through */ + fallthrough; case 2: pci_write_config16(dev, 0x66, reg_var[1]); - /* fall through */ + fallthrough; case 1: //pci_write_config16(dev, 0x64, reg_var[0]); //cause filo can not find sata break; diff --git a/src/southbridge/amd/pi/hudson/lpc.c b/src/southbridge/amd/pi/hudson/lpc.c index b77548e..888a8b1 100644 --- a/src/southbridge/amd/pi/hudson/lpc.c +++ b/src/southbridge/amd/pi/hudson/lpc.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */
#include <amdblocks/acpimmio.h> +#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <device/device.h> #include <device/pci.h> @@ -301,10 +302,10 @@ switch (var_num) { case 3: pci_write_config16(dev, 0x90, reg_var[2]); - /* fall through */ + fallthrough; case 2: pci_write_config16(dev, 0x66, reg_var[1]); - /* fall through */ + fallthrough; case 1: pci_write_config16(dev, 0x64, reg_var[0]); break; diff --git a/src/superio/nuvoton/nct5104d/superio.c b/src/superio/nuvoton/nct5104d/superio.c index 3351ad9..a6df4ed 100644 --- a/src/superio/nuvoton/nct5104d/superio.c +++ b/src/superio/nuvoton/nct5104d/superio.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <commonlib/bsd/compiler.h> #include <console/console.h> #include <device/pnp.h> #include <device/device.h> @@ -183,7 +184,7 @@ case NCT5104D_GPIO0: case NCT5104D_GPIO1: route_pins_to_uart(dev, false); - /* FALLTHROUGH */ + fallthrough; case NCT5104D_GPIO6: if (conf->reset_gpios) reset_gpio_default_in(dev);