fallthrough related handling
Subsystems (2)
cover fallthrough related handling
Fix lack of fallthrough checking and bug in e1000 driver.
Stephen Hemminger (2):
net/e1000: fix incorrect fallthrough in switch common/dpaax: do not disable fallthrough warnings
drivers/common/dpaax/caamflib/rta/operation_cmd.h | 4 ---- drivers/net/e1000/base/e1000_82575.c | 3 +-- drivers/net/e1000/base/e1000_api.c | 2 +- drivers/net/e1000/base/meson.build | 1 - 4 files changed, 2 insertions(+), 8 deletions(-)
Signature · 1 line
2.45.2
PATCH 1/2 net/e1000: fix incorrect fallthrough in switch
There is an incorrect fallthrough identified by PVS studio. Even though this is in base code it should be fixed, and the warning should be re-enabled to prevent future bugs.
--- drivers/net/e1000/base/e1000_82575.c | 3 +-- drivers/net/e1000/base/e1000_api.c | 2 +- drivers/net/e1000/base/meson.build | 1 - 3 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/e1000/base/e1000_82575.c +1 -2
@@ -1721,7 +1721,7 @@ STATIC s32 e1000_get_media_type_82575(struct e1000_hw *hw) dev_spec->sgmii_active = true;break ; } -/* Fall through for I2C based SGMII */ +/* fallthrough */ case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES :/* read media type from SFP EEPROM */ ret_val =e1000_set_sfp_media_type_82575 (hw);
@@ -3585,4 +3585,3 @@ void e1000_i2c_bus_clear(struct e1000_hw *hw)/* Put the i2c bus back to default state */ e1000_i2c_stop (hw); } -
drivers/net/e1000/base/e1000_api.c +1 -1
@@ -295,6 +295,7 @@ s32 e1000_set_mac_type(struct e1000_hw *hw)case E1000_DEV_ID_PCH_RPL_I219_LM23 :case E1000_DEV_ID_PCH_RPL_I219_V23 : mac->type = e1000_pch_tgp; +break ;case E1000_DEV_ID_PCH_ADL_I219_LM17 :case E1000_DEV_ID_PCH_ADL_I219_V17 :case E1000_DEV_ID_PCH_RPL_I219_LM22 :
@@ -1368,4 +1369,3 @@ void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw)if (hw->mac.ops.shutdown_serdes) hw->mac.ops.shutdown_serdes (hw); } -
drivers/net/e1000/base/meson.build +0 -1
@@ -24,7 +24,6 @@ sources = [ error_cflags = [ '-Wno-unused-parameter', - '-Wno-implicit-fallthrough', ] c_args = cflags foreach flag: error_cflags
Signature · 1 line
2.45.2
Re: [PATCH 1/2] net/e1000: fix incorrect fallthrough in switch
Quoted 10 lines · Stephen Hemminger
There is an incorrect fallthrough identified by PVS studio. Even though this is in base code it should be fixed, and the warning should be re-enabled to prevent future bugs.
Fixes f2553cb9eba6 ("net/e1000/base: add new I219 devices")Signed-off-by Stephen Hemminger <[email protected]>
Thanks. Two minor comments below.
Quoted 11 lines
--- drivers/net/e1000/base/e1000_82575.c | 3 +-- drivers/net/e1000/base/e1000_api.c | 2 +- drivers/net/e1000/base/meson.build | 1 - 3 files changed, 2 insertions(+), 4 deletions(-)drivers/net/e1000/base/e1000_82575.c +0
-0
drivers/net/e1000/base/e1000_82575.c STATIC s32 e1000_get_media_type_82575(struct e1000_hw *hw) · line 1724
Quoted 5 lines
drivers/net/e1000/base/e1000_82575.c +1
-1@@ -1721,7 +1721,7 @@ STATIC s32 e1000_get_media_type_82575(struct e1000_hw *hw) dev_spec->sgmii_active = true;break ; } -/* Fall through for I2C based SGMII */ +/* fallthrough */
Can we keep the old comment as well as the new?
drivers/net/e1000/base/e1000_82575.c void e1000_i2c_bus_clear(struct e1000_hw *hw) · line 3588
Quoted 8 lines
drivers/net/e1000/base/e1000_82575.c +0
-1case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES :/* read media type from SFP EEPROM */ ret_val =e1000_set_sfp_media_type_82575 (hw);@@ -3585,4 +3585,3 @@ void e1000_i2c_bus_clear(struct e1000_hw *hw)/* Put the i2c bus back to default state */ e1000_i2c_stop (hw); } -
Unrelated whitespace change, and also below. No big deal though.
Quoted 32 lines
drivers/net/e1000/base/e1000_api.c +1
-1@@ -295,6 +295,7 @@ s32 e1000_set_mac_type(struct e1000_hw *hw)case E1000_DEV_ID_PCH_RPL_I219_LM23 :case E1000_DEV_ID_PCH_RPL_I219_V23 : mac->type = e1000_pch_tgp; +break ;case E1000_DEV_ID_PCH_ADL_I219_LM17 :case E1000_DEV_ID_PCH_ADL_I219_V17 :case E1000_DEV_ID_PCH_RPL_I219_LM22 :@@ -1368,4 +1369,3 @@ void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw)if (hw->mac.ops.shutdown_serdes) hw->mac.ops.shutdown_serdes (hw); } -drivers/net/e1000/base/meson.build +0
-1@@ -24,7 +24,6 @@ sources = [ error_cflags = [ '-Wno-unused-parameter', - '-Wno-implicit-fallthrough', ] c_args = cflags foreach flag: error_cflagsSignature · 1 line
2.45.2
PATCH 2/2 common/dpaax: do not disable fallthrough warnings
In reply to Stephen HemmingerFallthrough warnings catch real bugs and should not be disabled. There are warnings in this driver in current build.
The commit that added the disable is old, and the problematic code appears to have been already removed.
--- drivers/common/dpaax/caamflib/rta/operation_cmd.h | 4 ---- 1 file changed, 4 deletions(-)
drivers/common/dpaax/caamflib/rta/operation_cmd.h +0 -4
@@ -7,10 +7,6 @@#ifndef __RTA_OPERATION_CMD_H__#define __RTA_OPERATION_CMD_H__ -#if defined(RTE_TOOLCHAIN_GCC ) && (GCC_VERSION >=70000 ) -#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" -#endif -extern enum rta_sec_era rta_sec_era; static inline int
Signature · 1 line
2.45.2
Re: [PATCH 2/2] common/dpaax: do not disable fallthrough warnings
Quoted 19 lines · Stephen Hemminger
Fallthrough warnings catch real bugs and should not be disabled. There are warnings in this driver in current build.
The commit that added the disable is old, and the problematic code appears to have been already removed.
Fixes 2ab9a9483196 ("crypto/dpaa2_sec: fix build with GCC 7")Signed-off-by Stephen Hemminger <[email protected]>--- drivers/common/dpaax/caamflib/rta/operation_cmd.h | 4 ---- 1 file changed, 4 deletions(-)drivers/common/dpaax/caamflib/rta/operation_cmd.h +0
-0
drivers/common/dpaax/caamflib/rta/operation_cmd.h line 12
Quoted 10 lines
drivers/common/dpaax/caamflib/rta/operation_cmd.h +0
-4@@ -7,10 +7,6 @@#ifndef __RTA_OPERATION_CMD_H__#define __RTA_OPERATION_CMD_H__ -#if defined(RTE_TOOLCHAIN_GCC ) && (GCC_VERSION >=70000 ) -#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" -#endif -extern enum rta_sec_era rta_sec_era; static inline int
v2 cover re-enable implicit fallthrough checks
In reply to Stephen HemmingerFix bug detected from bad fallthroug in E1000 code. And re-enable compiler flag in both e1000 and dpaax
v2 - minor comment fix
Stephen Hemminger (2):
common/dpaax: do not disable fallthrough warnings net/e1000: fix incorrect fallthrough in switch
drivers/common/dpaax/caamflib/rta/operation_cmd.h | 4 ---- drivers/net/e1000/base/e1000_82575.c | 2 +- drivers/net/e1000/base/e1000_api.c | 2 +- drivers/net/e1000/base/meson.build | 1 - 4 files changed, 2 insertions(+), 7 deletions(-)
Signature · 1 line
2.45.2
PATCH v2 1/2 common/dpaax: do not disable fallthrough warnings
Fallthrough warnings catch real bugs and should not be disabled. There are warnings in this driver in current build.
The commit that added the disable is old, and the problematic code appears to have been already removed.
--- drivers/common/dpaax/caamflib/rta/operation_cmd.h | 4 ---- 1 file changed, 4 deletions(-)
drivers/common/dpaax/caamflib/rta/operation_cmd.h +0 -4
@@ -7,10 +7,6 @@#ifndef __RTA_OPERATION_CMD_H__#define __RTA_OPERATION_CMD_H__ -#if defined(RTE_TOOLCHAIN_GCC ) && (GCC_VERSION >=70000 ) -#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" -#endif -extern enum rta_sec_era rta_sec_era; static inline int
Signature · 1 line
2.45.2
PATCH v2 2/2 net/e1000: fix incorrect fallthrough in switch
In reply to Stephen HemmingerThere is an incorrect fallthrough identified by PVS studio. Even though this is in base code it should be fixed, and the warning should be re-enabled to prevent future bugs.
--- drivers/net/e1000/base/e1000_82575.c | 2 +- drivers/net/e1000/base/e1000_api.c | 2 +- drivers/net/e1000/base/meson.build | 1 - 3 files changed, 2 insertions(+), 3 deletions(-)
drivers/net/e1000/base/e1000_82575.c +1 -1
@@ -1722,6 +1722,7 @@ STATIC s32 e1000_get_media_type_82575(struct e1000_hw *hw)break ; }/* Fall through for I2C based SGMII */ +/* Fall through */ case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES :/* read media type from SFP EEPROM */ ret_val =e1000_set_sfp_media_type_82575 (hw);
@@ -3585,4 +3586,3 @@ void e1000_i2c_bus_clear(struct e1000_hw *hw)/* Put the i2c bus back to default state */ e1000_i2c_stop (hw); } -
drivers/net/e1000/base/e1000_api.c +1 -1
@@ -295,6 +295,7 @@ s32 e1000_set_mac_type(struct e1000_hw *hw)case E1000_DEV_ID_PCH_RPL_I219_LM23 :case E1000_DEV_ID_PCH_RPL_I219_V23 : mac->type = e1000_pch_tgp; +break ;case E1000_DEV_ID_PCH_ADL_I219_LM17 :case E1000_DEV_ID_PCH_ADL_I219_V17 :case E1000_DEV_ID_PCH_RPL_I219_LM22 :
@@ -1368,4 +1369,3 @@ void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw)if (hw->mac.ops.shutdown_serdes) hw->mac.ops.shutdown_serdes (hw); } -
drivers/net/e1000/base/meson.build +0 -1
@@ -24,7 +24,6 @@ sources = [ error_cflags = [ '-Wno-unused-parameter', - '-Wno-implicit-fallthrough', ] c_args = cflags foreach flag: error_cflags
Signature · 1 line
2.45.2
Thomas Monjalon
AppliedRe: [PATCH v2 0/2] re-enable implicit fallthrough checks
In reply to Stephen Hemminger14/11/2024 18:11, Stephen Hemminger:
Quoted 8 lines
Fix bug detected from bad fallthroug in E1000 code. And re-enable compiler flag in both e1000 and dpaax
v2 - minor comment fix
Stephen Hemminger (2):
common/dpaax: do not disable fallthrough warnings net/e1000: fix incorrect fallthrough in switch
Applied, thanks.