From patchwork Wed Feb 20 11:13:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 10821855 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8D7A01399 for ; Wed, 20 Feb 2019 11:15:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72C1B2DB0B for ; Wed, 20 Feb 2019 11:15:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 637262DFCA; Wed, 20 Feb 2019 11:15:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 20CDF2DB0B for ; Wed, 20 Feb 2019 11:15:25 +0000 (UTC) Received: from localhost ([127.0.0.1]:38153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwPqX-0001JB-3p for patchwork-qemu-devel@patchwork.kernel.org; Wed, 20 Feb 2019 06:15:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwPpJ-0008HD-PB for qemu-devel@nongnu.org; Wed, 20 Feb 2019 06:14:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwPpG-00085g-El for qemu-devel@nongnu.org; Wed, 20 Feb 2019 06:14:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34996) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gwPp6-0007Xp-Vl for qemu-devel@nongnu.org; Wed, 20 Feb 2019 06:13:58 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CD83FAC2C2; Wed, 20 Feb 2019 11:13:53 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-228.ams2.redhat.com [10.36.116.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3919417B15; Wed, 20 Feb 2019 11:13:48 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1622B11AB8; Wed, 20 Feb 2019 12:13:47 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 20 Feb 2019 12:13:40 +0100 Message-Id: <20190220111346.13669-4-kraxel@redhat.com> In-Reply-To: <20190220111346.13669-1-kraxel@redhat.com> References: <20190220111346.13669-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 20 Feb 2019 11:13:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/9] xhci: check device is not NULL before calling usb_ep_get() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Liam Merwick Signed-off-by: Liam Merwick Message-id: 1549460216-25808-4-git-send-email-liam.merwick@oracle.com Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-xhci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 99b83aaa9e..ec28bee319 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -3276,10 +3276,10 @@ static USBEndpoint *xhci_epid_to_usbep(XHCIEPContext *epctx) return NULL; } uport = epctx->xhci->slots[epctx->slotid - 1].uport; + if (!uport || !uport->dev) { + return NULL; + } token = (epctx->epid & 1) ? USB_TOKEN_IN : USB_TOKEN_OUT; - if (!uport) { - return NULL; - } return usb_ep_get(uport->dev, token, epctx->epid >> 1); }