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 325C6941B87 for ; Mon, 13 Nov 2023 17:00:27 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=/EXU4PjIX1SpP0ZH6L345gTsXo2sEQt3NMy1JzX3C0Y=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1699894825; v=1; b=IASU+wNcpAUf4OH2UWaqvFiO35mNugmPuYwauh6Gwh0/DS0gO8g57o6GYAfmVE+E++8qy07i Xg6X1TzLNMVe5OEZglpmfDz3TtNh1L/MwkixIMqCGnXrOGmmyQxy0INpnc+4LkSYZLbu5djU85d vTagJ8WxifW7eH60I2MjXXRc= X-Received: by 127.0.0.2 with SMTP id ma3UYY7687511xsllmH2KRbH; Mon, 13 Nov 2023 09:00:25 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.505.1699894825252365381 for ; Mon, 13 Nov 2023 09:00:25 -0800 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-255-fQBJ9UGnPbmOmIZ--i2pHA-1; Mon, 13 Nov 2023 12:00:20 -0500 X-MC-Unique: fQBJ9UGnPbmOmIZ--i2pHA-1 X-Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 78FE83C025BB; Mon, 13 Nov 2023 17:00:19 +0000 (UTC) X-Received: from [10.39.192.220] (unknown [10.39.192.220]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B9CA2026D4C; Mon, 13 Nov 2023 17:00:18 +0000 (UTC) Message-ID: <57ee760a-ea90-b566-55ac-ea5162cb1d2c@redhat.com> Date: Mon, 13 Nov 2023 18:00:17 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH v3 2/2] MdeModulePkg/Bus/Pci/XhciDxe: Fix MISSING_BREAK Coverity issues To: devel@edk2.groups.io, rsingh@ventanamicro.com Cc: Ray Ni References: <20231110052231.447797-1-rsingh@ventanamicro.com> <20231110052231.447797-3-rsingh@ventanamicro.com> From: "Laszlo Ersek" In-Reply-To: <20231110052231.447797-3-rsingh@ventanamicro.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: wIwm1lzpMVJyCGAAo17Iq3R9x7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 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=IASU+wNc; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=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 On 11/10/23 06:22, Ranbir Singh wrote: > From: Ranbir Singh >=20 > The functions > XhcInitializeEndpointContext and XhcInitializeEndpointContext64 has > a switch-case code in which the case USB_ENDPOINT_CONTROL: falls > through to default: >=20 > 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. >=20 > Merge the USB_ENDPOINT_CONTROL and default using conditional debug print. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4221 >=20 > Cc: Ray Ni > Signed-off-by: Ranbir Singh > --- > MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 33 +++++++++++--------- > 1 file changed, 19 insertions(+), 14 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/= Pci/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; > UINTN EpIndex; > UINT8 EpAddr; > + UINT8 EpType; > UINT8 Direction; > UINT8 Dci; > UINT8 MaxDci; > @@ -2871,7 +2872,8 @@ XhcInitializeEndpointContext ( > InputContext->EP[Dci-1].MaxBurstSize =3D 0x0; > } > =20 > - switch (EpDesc->Attributes & USB_ENDPOINT_TYPE_MASK) { > + EpType =3D EpDesc->Attributes & USB_ENDPOINT_TYPE_MASK; > + switch (EpType) { > case USB_ENDPOINT_BULK: > if (Direction =3D=3D EfiUsbDataIn) { > InputContext->EP[Dci-1].CErr =3D 3; > @@ -2974,13 +2976,13 @@ XhcInitializeEndpointContext ( > =20 > break; > =20 > - case USB_ENDPOINT_CONTROL: > - // > - // Do not support control transfer now. > - // > - DEBUG ((DEBUG_INFO, "XhcInitializeEndpointContext: Unsupport Con= trol EP found, Transfer ring is not allocated.\n")); > default: > - DEBUG ((DEBUG_INFO, "XhcInitializeEndpointContext: Unknown EP fo= und, Transfer ring is not allocated.\n")); > + DEBUG (( > + DEBUG_INFO, > + "%a: %a found, Transfer ring is not allocated.\n", > + __func__, > + (EpType =3D=3D USB_ENDPOINT_CONTROL ? "Unsupported Control EP"= : "Unknown EP") > + )); > EpDesc =3D (USB_ENDPOINT_DESCRIPTOR *)((UINTN)EpDesc + EpDesc->L= ength); > continue; > } > @@ -3028,6 +3030,7 @@ XhcInitializeEndpointContext64 ( > UINTN NumEp; > UINTN EpIndex; > UINT8 EpAddr; > + UINT8 EpType; > UINT8 Direction; > UINT8 Dci; > UINT8 MaxDci; > @@ -3074,7 +3077,8 @@ XhcInitializeEndpointContext64 ( > InputContext->EP[Dci-1].MaxBurstSize =3D 0x0; > } > =20 > - switch (EpDesc->Attributes & USB_ENDPOINT_TYPE_MASK) { > + EpType =3D EpDesc->Attributes & USB_ENDPOINT_TYPE_MASK; > + switch (EpType) { > case USB_ENDPOINT_BULK: > if (Direction =3D=3D EfiUsbDataIn) { > InputContext->EP[Dci-1].CErr =3D 3; > @@ -3177,13 +3181,14 @@ XhcInitializeEndpointContext64 ( > =20 > break; > =20 > - case USB_ENDPOINT_CONTROL: > - // > - // Do not support control transfer now. > - // > - DEBUG ((DEBUG_INFO, "XhcInitializeEndpointContext64: Unsupport C= ontrol EP found, Transfer ring is not allocated.\n")); > default: > - DEBUG ((DEBUG_INFO, "XhcInitializeEndpointContext64: Unknown EP = found, Transfer ring is not allocated.\n")); > + DEBUG (( > + DEBUG_INFO, > + "%a: %a found, Transfer ring is not allocated.\n", > + __func__, > + ((EpType =3D=3D USB_ENDPOINT_CONTROL) ? "Unsupported Control E= P" : "Unknown EP") > + )); > + > EpDesc =3D (USB_ENDPOINT_DESCRIPTOR *)((UINTN)EpDesc + EpDesc->L= ength); > continue; > } Reviewed-by: Laszlo Ersek -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111167): https://edk2.groups.io/g/devel/message/111167 Mute This Topic: https://groups.io/mt/102502056/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-