diff options
| author | Andrew Goodbody <[email protected]> | 2025-08-06 10:37:26 +0100 |
|---|---|---|
| committer | Jerome Forissier <[email protected]> | 2025-08-18 14:08:57 +0200 |
| commit | 4b2d64f3885a83fd001993785f74f70cc6045acc (patch) | |
| tree | b5260a7e3064ae4e4a38c25f3e0e717a6e37dfd3 /drivers/net/phy | |
| parent | 0ce7fef9e2154d188bd50ae687fb666faac8fe7b (diff) | |
net: phy: vitesse: Fix incorrect test for timeout
In vsc8514_config there is a while loop for detecting a config failure
using a timeout counter with a post-decrement. In the case of a timeout
this will result in the loop exiting with timeout == -1 so use that as
the test below the loop to detect that the timeout occurred.
This issue was found by Smatch.
Signed-off-by: Andrew Goodbody <[email protected]>
Reviewed-by: Quentin Schulz <[email protected]>
Diffstat (limited to 'drivers/net/phy')
| -rw-r--r-- | drivers/net/phy/vitesse.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c index 4867d1931b4..821d3878236 100644 --- a/drivers/net/phy/vitesse.c +++ b/drivers/net/phy/vitesse.c @@ -239,7 +239,7 @@ static int vsc8514_config(struct phy_device *phydev) while ((val & MIIM_VSC8514_18G_CMDSTAT) && timeout--) val = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_VSC8514_GENERAL18); - if (0 == timeout) { + if (timeout == -1) { printf("PHY 8514 config failed\n"); return -1; } |
