Module Name: src Committed By: maxv Date: Mon Sep 23 17:37:04 UTC 2019
Modified Files: src/sys/dev/ic: an.c Log Message: Move the timeout check out of the loop, otherwise it is never reached. Found by the lgtm bot. To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/sys/dev/ic/an.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ic/an.c diff -u src/sys/dev/ic/an.c:1.71 src/sys/dev/ic/an.c:1.72 --- src/sys/dev/ic/an.c:1.71 Fri Sep 20 11:29:47 2019 +++ src/sys/dev/ic/an.c Mon Sep 23 17:37:04 2019 @@ -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 <wp...@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 le 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);