summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-08-26 14:48:35 +0200
committerRalf Baechle <ralf@linux-mips.org>2009-09-17 20:07:41 +0200
commitfff9c815291d5f4132976ac337337ea5813663e6 (patch)
treea21bac02e7de98ddc773d61ad98b77e8b55d7fe6 /drivers
parente3bf887d73309808d47c74f2f024d2497c8f7048 (diff)
MIPS: Octeon: False positive timeout
If we reach the test just below the loop with a `timeout' value of 0, this does not mean that the timeout caused the loop to end, but rather the `smi_rd.s.pending', in the last iteration. If timeout caused the loop to end, then `timeout' is -1, not 0. Since this can occur only in the last iteration, it is not very likely to be a problem. By changing the post- to prefix decrement we ensure that a timeout of 0 does mean it timed out. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Acked-by: David Daney <ddaney@caviumnetworks.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/octeon/cvmx-mdio.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/octeon/cvmx-mdio.h b/drivers/staging/octeon/cvmx-mdio.h
index c987a75a20cf..f45dc49512f2 100644
--- a/drivers/staging/octeon/cvmx-mdio.h
+++ b/drivers/staging/octeon/cvmx-mdio.h
@@ -421,7 +421,7 @@ static inline int cvmx_mdio_45_read(int bus_id, int phy_id, int device,
do {
cvmx_wait(1000);
smi_rd.u64 = cvmx_read_csr(CVMX_SMIX_RD_DAT(bus_id));
- } while (smi_rd.s.pending && timeout--);
+ } while (smi_rd.s.pending && --timeout);
if (timeout <= 0) {
cvmx_dprintf("cvmx_mdio_45_read: bus_id %d phy_id %2d "