diff options
| author | Kevin Bowling <kbowling@FreeBSD.org> | 2026-08-11 19:40:48 +0000 |
|---|---|---|
| committer | Kevin Bowling <kbowling@FreeBSD.org> | 2026-08-11 20:59:33 +0000 |
| commit | 13a7470096567480676e24545b3c1d6404f3f2ec (patch) | |
| tree | 769de2b346e2db356e4c8ecf38fea44230d9a29c | |
| parent | 13d78e4b9d0a27128319a1241f00f7ab9aa864bb (diff) | |
e1000: Avoid signed shifts while assembling PHY IDs
PHY identifier words are promoted to signed int when the cast is applied
after the shift. Cast each 16-bit register value first so identifiers
with their high bit set are assembled as unsigned data.
MFC after: 2 weeks
| -rw-r--r-- | sys/dev/e1000/e1000_82571.c | 2 | ||||
| -rw-r--r-- | sys/dev/e1000/e1000_ich8lan.c | 2 | ||||
| -rw-r--r-- | sys/dev/e1000/e1000_phy.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/e1000/e1000_82571.c b/sys/dev/e1000/e1000_82571.c index fa010075f367..d02efd08a163 100644 --- a/sys/dev/e1000/e1000_82571.c +++ b/sys/dev/e1000/e1000_82571.c @@ -485,7 +485,7 @@ static s32 e1000_get_phy_id_82571(struct e1000_hw *hw) if (ret_val) return ret_val; - phy->id = (u32)(phy_id << 16); + phy->id = (u32)phy_id << 16; usec_delay(20); ret_val = phy->ops.read_reg(hw, PHY_ID2, &phy_id); if (ret_val) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 1fbdc35e74df..eb6971b0e530 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -211,7 +211,7 @@ static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw) ret_val = hw->phy.ops.read_reg_locked(hw, PHY_ID1, &phy_reg); if (ret_val || (phy_reg == 0xFFFF)) continue; - phy_id = (u32)(phy_reg << 16); + phy_id = (u32)phy_reg << 16; ret_val = hw->phy.ops.read_reg_locked(hw, PHY_ID2, &phy_reg); if (ret_val || (phy_reg == 0xFFFF)) { diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index 8b00a80337a1..7d12d98bffd8 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -238,7 +238,7 @@ s32 e1000_get_phy_id(struct e1000_hw *hw) if (ret_val) return ret_val; - phy->id = (u32)(phy_id << 16); + phy->id = (u32)phy_id << 16; usec_delay(20); ret_val = phy->ops.read_reg(hw, PHY_ID2, &phy_id); if (ret_val) |
