Re: [PATCH v2 net 1/3] amd-xgbe: fix link status handling in xgbe_rx_adaptation

From
Paolo Abeni <pabeni@redhat.com>
Date
2026-03-05 07:59:38
Also in
lkml
Reply to
Raju Rangoju, 2026-03-05
On 3/5/26 5:29 AM, Raju Rangoju wrote:
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index 1dbfa9d4360d..457d6049291f 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -1964,11 +1964,20 @@ static void xgbe_rx_adaptation(struct xgbe_prv_data *pdata)
 
 	/* Step 4: Check for Block lock */
 
-	/* Link status is latched low, so read once to clear
-	 * and then read again to get current state
-	 */
-	reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1);
 	reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1);
+	if (reg < 0)
Coccinelle says:

/srv/nipa-builds-contest/testing/wt-cocci/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:1968:5-8:
WARNING: Unsigned expression compared with zero: reg <
quoted hunk ↗ jump to hunk
+		goto set_mode;
+
+	/* Link status is latched low so that momentary link drops
+	 * can be detected. If link was already down read again
+	 * to get the latest state.
+	 */
+	if (!pdata->phy.link && !(reg & MDIO_STAT1_LSTATUS)) {
+		reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1);
+		if (reg < 0)
Same here.

/P
Thread (5 messages) 5 messages, 2 authors, last reply 2026-03-05
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help