b53_srab_request_grant() polls for a grant up to 20 times, but checks for an iteration count of five to detect a timeout. This rejects a grant received on the sixth poll and reports success when all 20 polls finish without a grant. The latter allows a register access to proceed without ownership of the switch resources. Check for exhaustion of all 20 iterations instead. Fixes: 967dd82ffc52 ("net: dsa: b53: Add support for Broadcom RoboSwitch") Reviewed-by: Jonas Gorski Signed-off-by: Florian Fainelli --- drivers/net/dsa/b53/b53_srab.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/b53/b53_srab.c b/drivers/net/dsa/b53/b53_srab.c index 83a03fca142a..f4689078ccd5 100644 --- a/drivers/net/dsa/b53/b53_srab.c +++ b/drivers/net/dsa/b53/b53_srab.c @@ -105,7 +105,7 @@ static int b53_srab_request_grant(struct b53_device *dev) break; usleep_range(10, 100); } - if (WARN_ON(i == 5)) + if (WARN_ON(i == 20)) return -EIO; return 0; -- 2.53.0