Skip to content

Commit

Permalink
net/ice/base: remove unreachable code
Browse files Browse the repository at this point in the history
[ upstream commit ca2011635fa38c71f47933d77ee618ca4d4f640f ]

The default condition in the switch statement in
ice_sched_get_psm_clk_freq() is an unreachable code. The variable
clk_src is restricted to values 0 to 3 with the bit mask and shift
values set.

Fixes: 76ac9d7 ("net/ice/base: read PSM clock frequency from register")

Signed-off-by: Vignesh Sridhar <vignesh.sridhar@intel.com>
Signed-off-by: Qiming Yang <qiming.yang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
  • Loading branch information
qimingya authored and kevintraynor committed Jul 11, 2023
1 parent cdd62be commit f420162
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
16 changes: 6 additions & 10 deletions drivers/net/ice/base/ice_sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1394,11 +1394,6 @@ void ice_sched_get_psm_clk_freq(struct ice_hw *hw)
clk_src = (val & GLGEN_CLKSTAT_SRC_PSM_CLK_SRC_M) >>
GLGEN_CLKSTAT_SRC_PSM_CLK_SRC_S;

#define PSM_CLK_SRC_367_MHZ 0x0
#define PSM_CLK_SRC_416_MHZ 0x1
#define PSM_CLK_SRC_446_MHZ 0x2
#define PSM_CLK_SRC_390_MHZ 0x3

switch (clk_src) {
case PSM_CLK_SRC_367_MHZ:
hw->psm_clk_freq = ICE_PSM_CLK_367MHZ_IN_HZ;
Expand All @@ -1412,11 +1407,12 @@ void ice_sched_get_psm_clk_freq(struct ice_hw *hw)
case PSM_CLK_SRC_390_MHZ:
hw->psm_clk_freq = ICE_PSM_CLK_390MHZ_IN_HZ;
break;
default:
ice_debug(hw, ICE_DBG_SCHED, "PSM clk_src unexpected %u\n",
clk_src);
/* fall back to a safe default */
hw->psm_clk_freq = ICE_PSM_CLK_446MHZ_IN_HZ;

/* default condition is not required as clk_src is restricted
* to a 2-bit value from GLGEN_CLKSTAT_SRC_PSM_CLK_SRC_M mask.
* The above switch statements cover the possible values of
* this variable.
*/
}
}

Expand Down
5 changes: 5 additions & 0 deletions drivers/net/ice/base/ice_sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
#define ICE_PSM_CLK_446MHZ_IN_HZ 446428571
#define ICE_PSM_CLK_390MHZ_IN_HZ 390625000

#define PSM_CLK_SRC_367_MHZ 0x0
#define PSM_CLK_SRC_416_MHZ 0x1
#define PSM_CLK_SRC_446_MHZ 0x2
#define PSM_CLK_SRC_390_MHZ 0x3

struct rl_profile_params {
u32 bw; /* in Kbps */
u16 rl_multiplier;
Expand Down

0 comments on commit f420162

Please sign in to comment.