On 11/08/2025 14:01, Quentin Schulz wrote:
Hi Andrew,
On 8/6/25 11:37 AM, Andrew Goodbody wrote:
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 <andrew.goodb...@linaro.org>
---
drivers/net/phy/vitesse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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) {
Could have used --timeout instead in the while loop and that could even
have allowed us to change the type of timeout to an unsigned number type.
Yes indeed but that would have meant 1 less pass through the loop and so
I chose to not affect the operation at all.
But that works too, so
Reviewed-by: Quentin Schulz <quentin.sch...@cherry.de>
Thanks!
Quentin
Thanks,
Andrew