git: 13a747009656 - main - e1000: Avoid signed shifts while assembling PHY IDs

Kevin Bowling <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a7b8d5c.370ba.30b6f413__20465.121224855$1786482274$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=13a7470096567480676e24545b3c1d6404f3f2ec

commit 13a7470096567480676e24545b3c1d6404f3f2ec
Author:     Kevin Bowling <[email protected]>
AuthorDate: 2026-08-11 19:40:48 +0000
Commit:     Kevin Bowling <[email protected]>
CommitDate: 2026-08-11 20:59:33 +0000

    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
---
 sys/dev/e1000/e1000_82571.c   | 2 +-
 sys/dev/e1000/e1000_ich8lan.c | 2 +-
 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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.