Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1589403 > unrolled thread

[PATCH] net: bcmgenet: fix off-by-one comparison on timeout

Started byColin King <colin.king@canonical.com>
First post2017-02-28 13:30 +0100
Last post2017-02-28 13:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] net: bcmgenet: fix off-by-one comparison on timeout Colin King <colin.king@canonical.com> - 2017-02-28 13:30 +0100

#1589403 — [PATCH] net: bcmgenet: fix off-by-one comparison on timeout

FromColin King <colin.king@canonical.com>
Date2017-02-28 13:30 +0100
Subject[PATCH] net: bcmgenet: fix off-by-one comparison on timeout
Message-ID<tfP4K-4lm-13@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

At the end of the timeout loop, timeout will be 1001 and not 1000 and
so the timeout error will never be detected. Fix the off-by-one
comparison by checking to see if timeout is greater than 1000.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index f928968..24e7201 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1829,7 +1829,7 @@ static int reset_umac(struct bcmgenet_priv *priv)
 		udelay(1);
 	}
 
-	if (timeout == 1000) {
+	if (timeout > 1000) {
 		dev_err(kdev,
 			"timeout waiting for MAC to come out of reset\n");
 		return -ETIMEDOUT;
-- 
2.10.2

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web