quoted hunk ↗ jump to hunk
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 <jonas.gorski@gmail.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
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))
I wondered why the initial check was i == 5. Seems like b53_srab_op(), just
below this one, has more or less the same loop, but with 5 iterations. Probably a
copy paste error.
return -EIO;
return 0;
--
2.53.0
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>