]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
amd-xgbe: fix a couple timeout loops
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 15 Dec 2015 10:12:29 +0000 (13:12 +0300)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 25 Jan 2016 10:43:50 +0000 (10:43 +0000)
commit c7557e6a56510ff6636d40ad4ff64a3ef7d9e197 upstream.

At the end of the loop we test "if (!count)" but because "count--" is
a post-op then the loop will end with count set to -1.  I have fixed
this by changing it to --count.

Fixes: c5aa9e3b8156 ('amd-xgbe: Initial AMD 10GbE platform driver')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/net/ethernet/amd/xgbe/xgbe-dev.c

index 002293b0819d19160b5ce87e7be03cee0d8aa745..7038ff66807bee1bea77fd038a6062e78c087713 100644 (file)
@@ -1296,7 +1296,7 @@ static int xgbe_exit(struct xgbe_prv_data *pdata)
        usleep_range(10, 15);
 
        /* Poll Until Poll Condition */
-       while (count-- && XGMAC_IOREAD_BITS(pdata, DMA_MR, SWR))
+       while (--count && XGMAC_IOREAD_BITS(pdata, DMA_MR, SWR))
                usleep_range(500, 600);
 
        if (!count)
@@ -1317,7 +1317,7 @@ static int xgbe_flush_tx_queues(struct xgbe_prv_data *pdata)
        /* Poll Until Poll Condition */
        for (i = 0; i < pdata->hw_feat.tx_q_cnt; i++) {
                count = 2000;
-               while (count-- && XGMAC_MTL_IOREAD_BITS(pdata, i,
+               while (--count && XGMAC_MTL_IOREAD_BITS(pdata, i,
                                                        MTL_Q_TQOMR, FTQ))
                        usleep_range(500, 600);