From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 98D99AC0B91 for ; Fri, 10 Nov 2023 05:22:42 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=beztwgQmMm0X+kCkC8T6or8jE+agSvNv0VOTC5+ZaL0=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1699593761; v=1; b=k0NHDqXpDJH8i9AOTs/9IvYzSmHq5l9y+tQHTtndUcVfbENjJlbbV6ksNdEjf1nFLfm0PNlS hE9fPc+Mr7IcueLbf0bsCdCtEMwwXcNBFib0sWHcPAa+z55yYAlDHb4jo6WA5x5JAjdKL9/oSKq 7mvG4f6CePOwbCR8hnYGOlo8= X-Received: by 127.0.0.2 with SMTP id uciYYY7687511xZvfQnGkxlI; Thu, 09 Nov 2023 21:22:41 -0800 X-Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mx.groups.io with SMTP id smtpd.web10.21870.1699593760529075169 for ; Thu, 09 Nov 2023 21:22:40 -0800 X-Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1cc9b626a96so13827495ad.2 for ; Thu, 09 Nov 2023 21:22:40 -0800 (PST) X-Gm-Message-State: 6j7356jJehhwd7edSWPzuVpTx7686176AA= X-Google-Smtp-Source: AGHT+IHjkfUmrfw+eaEdIlcaVXhq9T2bMEENimaS2xsSyCJ9u8tfDNYhHFYnuGFyrZSxnZmv5lk1sA== X-Received: by 2002:a17:902:f64e:b0:1cc:3932:4a95 with SMTP id m14-20020a170902f64e00b001cc39324a95mr9005868plg.62.1699593759862; Thu, 09 Nov 2023 21:22:39 -0800 (PST) X-Received: from user-Latitude-5420.. ([2401:4900:1f24:28fe:9291:5de9:ca67:1893]) by smtp.gmail.com with ESMTPSA id a13-20020a170902b58d00b001c9db5e2929sm4467064pls.93.2023.11.09.21.22.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 21:22:39 -0800 (PST) From: "Ranbir Singh" To: devel@edk2.groups.io, rsingh@ventanamicro.com Cc: Ray Ni Subject: [edk2-devel] [PATCH v3 2/2] MdeModulePkg/Bus/Pci/XhciDxe: Fix MISSING_BREAK Coverity issues Date: Fri, 10 Nov 2023 10:52:31 +0530 Message-Id: <20231110052231.447797-3-rsingh@ventanamicro.com> In-Reply-To: <20231110052231.447797-1-rsingh@ventanamicro.com> References: <20231110052231.447797-1-rsingh@ventanamicro.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,rsingh@ventanamicro.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=k0NHDqXp; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Ranbir Singh The functions XhcInitializeEndpointContext and XhcInitializeEndpointContext64 has a switch-case code in which the case USB_ENDPOINT_CONTROL: falls through to default: While this may be intentional, it may not be evident to any general code reader/developer or static analyis tool why there is no break in between. Merge the USB_ENDPOINT_CONTROL and default using conditional debug print. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4221 Cc: Ray Ni Signed-off-by: Ranbir Singh --- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 33 +++++++++++--------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pc= i/XhciDxe/XhciSched.c index 05528a478baf..00b3a13a95bb 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -2825,6 +2825,7 @@ XhcInitializeEndpointContext ( UINTN NumEp;=0D UINTN EpIndex;=0D UINT8 EpAddr;=0D + UINT8 EpType;=0D UINT8 Direction;=0D UINT8 Dci;=0D UINT8 MaxDci;=0D @@ -2871,7 +2872,8 @@ XhcInitializeEndpointContext ( InputContext->EP[Dci-1].MaxBurstSize =3D 0x0;=0D }=0D =0D - switch (EpDesc->Attributes & USB_ENDPOINT_TYPE_MASK) {=0D + EpType =3D EpDesc->Attributes & USB_ENDPOINT_TYPE_MASK;=0D + switch (EpType) {=0D case USB_ENDPOINT_BULK:=0D if (Direction =3D=3D EfiUsbDataIn) {=0D InputContext->EP[Dci-1].CErr =3D 3;=0D @@ -2974,13 +2976,13 @@ XhcInitializeEndpointContext ( =0D break;=0D =0D - case USB_ENDPOINT_CONTROL:=0D - //=0D - // Do not support control transfer now.=0D - //=0D - DEBUG ((DEBUG_INFO, "XhcInitializeEndpointContext: Unsupport Contr= ol EP found, Transfer ring is not allocated.\n"));=0D default:=0D - DEBUG ((DEBUG_INFO, "XhcInitializeEndpointContext: Unknown EP foun= d, Transfer ring is not allocated.\n"));=0D + DEBUG ((=0D + DEBUG_INFO,=0D + "%a: %a found, Transfer ring is not allocated.\n",=0D + __func__,=0D + (EpType =3D=3D USB_ENDPOINT_CONTROL ? "Unsupported Control EP" := "Unknown EP")=0D + ));=0D EpDesc =3D (USB_ENDPOINT_DESCRIPTOR *)((UINTN)EpDesc + EpDesc->Len= gth);=0D continue;=0D }=0D @@ -3028,6 +3030,7 @@ XhcInitializeEndpointContext64 ( UINTN NumEp;=0D UINTN EpIndex;=0D UINT8 EpAddr;=0D + UINT8 EpType;=0D UINT8 Direction;=0D UINT8 Dci;=0D UINT8 MaxDci;=0D @@ -3074,7 +3077,8 @@ XhcInitializeEndpointContext64 ( InputContext->EP[Dci-1].MaxBurstSize =3D 0x0;=0D }=0D =0D - switch (EpDesc->Attributes & USB_ENDPOINT_TYPE_MASK) {=0D + EpType =3D EpDesc->Attributes & USB_ENDPOINT_TYPE_MASK;=0D + switch (EpType) {=0D case USB_ENDPOINT_BULK:=0D if (Direction =3D=3D EfiUsbDataIn) {=0D InputContext->EP[Dci-1].CErr =3D 3;=0D @@ -3177,13 +3181,14 @@ XhcInitializeEndpointContext64 ( =0D break;=0D =0D - case USB_ENDPOINT_CONTROL:=0D - //=0D - // Do not support control transfer now.=0D - //=0D - DEBUG ((DEBUG_INFO, "XhcInitializeEndpointContext64: Unsupport Con= trol EP found, Transfer ring is not allocated.\n"));=0D default:=0D - DEBUG ((DEBUG_INFO, "XhcInitializeEndpointContext64: Unknown EP fo= und, Transfer ring is not allocated.\n"));=0D + DEBUG ((=0D + DEBUG_INFO,=0D + "%a: %a found, Transfer ring is not allocated.\n",=0D + __func__,=0D + ((EpType =3D=3D USB_ENDPOINT_CONTROL) ? "Unsupported Control EP"= : "Unknown EP")=0D + ));=0D +=0D EpDesc =3D (USB_ENDPOINT_DESCRIPTOR *)((UINTN)EpDesc + EpDesc->Len= gth);=0D continue;=0D }=0D --=20 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111013): https://edk2.groups.io/g/devel/message/111013 Mute This Topic: https://groups.io/mt/102502056/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-