summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authormaxv <maxv@NetBSD.org>2019-09-23 17:37:04 +0000
committermaxv <maxv@NetBSD.org>2019-09-23 17:37:04 +0000
commit328a8121b8aec14df36a036d04f6017789e7539b (patch)
tree96294116e8f70c44675eb9ecd236c702877477a5 /sys/dev
parent7946db664cf1f72718642b3a25184251d621311e (diff)
Move the timeout check out of the loop, otherwise it is never reached.
Found by the lgtm bot.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/an.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c
index 0e8d5e29714..d45c2c59cdd 100644
--- a/sys/dev/ic/an.c
+++ b/sys/dev/ic/an.c
@@ -1,4 +1,4 @@
-/* $NetBSD: an.c,v 1.71 2019/09/20 11:29:47 maxv Exp $ */
+/* $NetBSD: an.c,v 1.72 2019/09/23 17:37:04 maxv Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.71 2019/09/20 11:29:47 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.72 2019/09/23 17:37:04 maxv Exp $");
#include <sys/param.h>
@@ -1796,12 +1796,12 @@ an_alloc_fid(struct an_softc *sc, int len, int *idp)
for (i = 0; i < AN_TIMEOUT; i++) {
if (CSR_READ_2(sc, AN_EVENT_STAT) & AN_EV_ALLOC)
break;
- if (i == AN_TIMEOUT) {
- printf("%s: timeout in alloc\n", device_xname(sc->sc_dev));
- return ETIMEDOUT;
- }
DELAY(10);
}
+ if (i == AN_TIMEOUT) {
+ printf("%s: timeout in alloc\n", device_xname(sc->sc_dev));
+ return ETIMEDOUT;
+ }
*idp = CSR_READ_2(sc, AN_ALLOC_FID);
CSR_WRITE_2(sc, AN_EVENT_ACK, AN_EV_ALLOC);