From: kettenis Date: Wed, 17 Dec 2014 15:27:49 +0000 (+0000) Subject: Avoid premature masking in the interrupt handler code that checks for removed X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d7fcc0d09f7d736f7ceb60d2964cb81a8f859074;p=openbsd Avoid premature masking in the interrupt handler code that checks for removed hardware. ok mpi@, deraadt@ --- diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c index 704f3da76d2..83931dfc050 100644 --- a/sys/dev/usb/ehci.c +++ b/sys/dev/usb/ehci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ehci.c,v 1.171 2014/12/09 07:05:06 doug Exp $ */ +/* $OpenBSD: ehci.c,v 1.172 2014/12/17 15:27:49 kettenis Exp $ */ /* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */ /* @@ -524,11 +524,12 @@ ehci_intr1(struct ehci_softc *sc) return (0); } - intrs = EHCI_STS_INTRS(EOREAD4(sc, EHCI_USBSTS)); + intrs = EOREAD4(sc, EHCI_USBSTS); if (intrs == 0xffffffff) { sc->sc_bus.dying = 1; return (0); } + intrs = EHCI_STS_INTRS(intrs); if (!intrs) return (0); diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index bcccbd5b444..660d3e21523 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhci.c,v 1.133 2014/12/09 07:05:06 doug Exp $ */ +/* $OpenBSD: uhci.c,v 1.134 2014/12/17 15:27:50 kettenis Exp $ */ /* $NetBSD: uhci.c,v 1.172 2003/02/23 04:19:26 simonb Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -1020,13 +1020,14 @@ uhci_intr1(struct uhci_softc *sc) int status; int ack; - status = UREAD2(sc, UHCI_STS) & UHCI_STS_ALLINTRS; - if (status == 0) /* The interrupt was not for us. */ - return (0); - if (status == 0xffffffff) { + status = UREAD2(sc, UHCI_STS); + if (status == 0xffff) { sc->sc_bus.dying = 1; return (0); } + status &= UHCI_STS_ALLINTRS; + if (status == 0) /* The interrupt was not for us. */ + return (0); #ifdef UHCI_DEBUG if (uhcidebug > 15) {