diff options
| author | Andrew Goodbody <[email protected]> | 2025-08-04 17:03:59 +0100 |
|---|---|---|
| committer | Peng Fan <[email protected]> | 2025-08-27 15:39:58 +0800 |
| commit | 5b95f666fbd8f9c9c43726c7ced229762e4a35e0 (patch) | |
| tree | 830e6264d664aecf0354bee9540d50d810090e46 | |
| parent | 270798a4209aeb23fce72ebf10e62630f474e431 (diff) | |
net: fm: Correct test for timeout
In memac_wait_until_free and memac_wait_until_done the use of
post-decrement on the test in the while loop for a timeout means that
timeout will be equal to -1 on exit in that case. Adjust the test for
this expected value.
This issue was found by Smatch.
Signed-off-by: Andrew Goodbody <[email protected]>
Signed-off-by: Peng Fan <[email protected]>
| -rw-r--r-- | drivers/net/fm/memac_phy.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/fm/memac_phy.c b/drivers/net/fm/memac_phy.c index 26425d94ae5..1ad3c053593 100644 --- a/drivers/net/fm/memac_phy.c +++ b/drivers/net/fm/memac_phy.c @@ -46,7 +46,7 @@ static int memac_wait_until_free(struct memac_mdio_controller *regs) while ((memac_in_32(®s->mdio_stat) & MDIO_STAT_BSY) && timeout--) ; - if (!timeout) { + if (timeout == -1) { printf("timeout waiting for MDIO bus to be free\n"); return -ETIMEDOUT; } @@ -64,7 +64,7 @@ static int memac_wait_until_done(struct memac_mdio_controller *regs) while ((memac_in_32(®s->mdio_stat) & MDIO_STAT_BSY) && timeout--) ; - if (!timeout) { + if (timeout == -1) { printf("timeout waiting for MDIO operation to complete\n"); return -ETIMEDOUT; } |
