[PATCH] net: airoha: fix PCS calibration retry limit
Li Xiao <[email protected]>
| Newsgroups | org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <20260818-fix-airoha-pcs-calibration-retry-v1-1-5963d388c1ad@airoha.com> |
From: Li Xiao <[email protected]> The calibration retry counter starts at zero and is incremented after the limit check. Using a strict greater-than comparison therefore allows one more retry than AIROHA_PCS_MAX_CALIBRATION_TRY specifies. Use a greater-than-or-equal comparison so the function stops after the configured number of retries. Fixes: d4dd6eb29bda ("net: airoha: add support for Airoha PCS driver") Signed-off-by: Li Xiao <[email protected]> --- Fix an off-by-one condition in the Airoha AN7581 PCS calibration retry loop. The current comparison permits one retry beyond the configured limit. The change was build-tested with an7581_evb_defconfig. --- drivers/net/airoha/pcs-an7581.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/airoha/pcs-an7581.c b/drivers/net/airoha/pcs-an7581.c index 746ff55d72..bc15d9d07c 100644 --- a/drivers/net/airoha/pcs-an7581.c +++ b/drivers/net/airoha/pcs-an7581.c @@ -1321,7 +1321,7 @@ retry_calibration: */ regmap_read(priv->xfi_pma, AIROHA_PCS_PMA_RX_FREQDET, &val); if (!(val & AIROHA_PCS_PMA_FBCK_LOCK)) { - if (calibration_try > AIROHA_PCS_MAX_CALIBRATION_TRY) { + if (calibration_try >= AIROHA_PCS_MAX_CALIBRATION_TRY) { dev_err(priv->dev, "No FBCK Lock from FreqDet module after %d calibration try. PCS won't work.\n", AIROHA_PCS_MAX_CALIBRATION_TRY); return -EIO; --- base-commit: 527115ef6783cec49e5610c523c124b399011361 change-id: 20260814-fix-airoha-pcs-calibration-retry-f0c9f06f8122 Best regards, -- Li Xiao <[email protected]>