From nobody Tue Feb 10 20:47:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+64300+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+64300+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1597523200; cv=none; d=zohomail.com; s=zohoarc; b=RhbSRT/385rbWtzx7StMH8OCPmJ/X990KsKAAvHthxXLfHiQ9SWEWzpUIU885YPNLk/tuyHMFJYf+iF2+bXnXTFTcLsLdbbzj+YA3EilUguTkVcGD20e3iRFtJPChn3zDPBW2q95dt7Y5tJeUwzfRqduzOqKWPptjGNywHX6/Bo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597523200; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=PiCxIiRBRYZswcAQa+o2xrSH7hw3BAPpd2YHZh6ylUk=; b=RSh03ecA390zSHm7ynsK2CnI0EGUNcyuvFHGxHqdeQMyez9yeKxawt/mREqSvkqX9YiH7Qo59xjRUo0PJuzIM9UnTsi57TeYGseW4+M3GfFjmnZeriM4YZPSbr5erqOBgWnvZIdKWS57BYTzd14CRpk7RzUiuAnVAfRghFbyqLE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+64300+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1597523200966638.845571037313; Sat, 15 Aug 2020 13:26:40 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id sAMZYY1788612xMNy1igjORX; Sat, 15 Aug 2020 13:26:40 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.12719.1597523193291451517 for ; Sat, 15 Aug 2020 13:26:33 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B43D7101E; Sat, 15 Aug 2020 13:26:32 -0700 (PDT) X-Received: from U203705.lan (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 77B743F66B; Sat, 15 Aug 2020 13:26:32 -0700 (PDT) From: "Samer El-Haj-Mahmoud" To: devel@edk2.groups.io Cc: Leif Lindholm , Pete Batard , Andrei Warkentin , Ard Biesheuvel Subject: [edk2-devel] [edk2-platform][PATCH v1 2/3] Platforms/RaspberryPi: Fix DwUsbHostDxe ComponentName2 error checking Date: Sat, 15 Aug 2020 16:26:30 -0400 Message-Id: <20200815202631.29690-3-Samer.El-Haj-Mahmoud@arm.com> In-Reply-To: <20200815202631.29690-1-Samer.El-Haj-Mahmoud@arm.com> References: <20200815202631.29690-1-Samer.El-Haj-Mahmoud@arm.com> Precedence: Bulk List-Unsubscribe: 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,samer.el-haj-mahmoud@arm.com X-Gm-Message-State: a4fF2ZWrPV1cg0VbRfwwctsCx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1597523200; bh=FVU3oAx3uecTDB/aic9ftSlemx1u/cNg2l+9qo69GiE=; h=Cc:Date:From:Reply-To:Subject:To; b=BxNTVRvD9TUqFyMquiKMeE8yBmmbtSeAMzPwo52++iwv0IDBnG0D9rRgVuTNQPZfZ/z Q7HVoxbLMnVogha20kPLEYEqEKXoyVAWHGlkQMZzFcgWvX3BU8dLlONDpzDr1/ib+fgME yrnYEzB++nc8KxNP1lVGrBNSmtumHuz959Q= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Fix input param error checking for the DwUsbHostDxe ComponentName2 protocol. This fixes https://github.com/pftf/RPi4/issues/86 Cc: Leif Lindholm Cc: Pete Batard Cc: Andrei Warkentin Cc: Ard Biesheuvel Signed-off-by: Samer El-Haj-Mahmoud Reviewed-by: Pete Batard --- Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.h | 4 +++- Platform/RaspberryPi/Drivers/DwUsbHostDxe/ComponentName.c | 18 +++++++++++= +++++++ Platform/RaspberryPi/Drivers/DwUsbHostDxe/DriverBinding.c | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.h b/Pla= tform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.h index 106e5425355e..cf6c81b64ab5 100644 --- a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.h +++ b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.h @@ -1,5 +1,6 @@ /** @file * + * Copyright (c) 2020, ARM Limited. All rights reserved. * Copyright (c) 2017-2018, Andrey Warkentin * Copyright (c) 2015-2016, Linaro Limited. All rights reserved. * @@ -121,8 +122,9 @@ typedef struct _DWUSB_OTGHC_DEV { UINT16 LastMicroFrame; } DWUSB_OTGHC_DEV; =20 -extern EFI_COMPONENT_NAME_PROTOCOL gComponentName; +extern EFI_COMPONENT_NAME_PROTOCOL gComponentName; extern EFI_COMPONENT_NAME2_PROTOCOL gComponentName2; +extern EFI_DRIVER_BINDING_PROTOCOL mDriverBinding; =20 EFI_STATUS CreateDwUsbHc ( diff --git a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/ComponentName.c b/Pl= atform/RaspberryPi/Drivers/DwUsbHostDxe/ComponentName.c index 2f3c53323bf1..8639ab7d39c5 100644 --- a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/ComponentName.c +++ b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/ComponentName.c @@ -1,5 +1,6 @@ /** @file * + * Copyright (c) 2020, ARM Limited. All rights reserved. * Copyright (c) 2018, Andrey Warkentin * * SPDX-License-Identifier: BSD-2-Clause-Patent @@ -205,10 +206,27 @@ ComponentNameGetControllerName ( OUT CHAR16 **ControllerName ) { + EFI_STATUS Status; + + // + // This is a device driver, so ChildHandle must be NULL. + // if (ChildHandle !=3D NULL) { return EFI_UNSUPPORTED; } =20 + // + // Make sure this driver is currently managing ControllHandle + // + Status =3D EfiTestManagedDevice ( + ControllerHandle, + mDriverBinding.DriverBindingHandle, + &gEfiUsb2HcProtocolGuid + ); + if (EFI_ERROR (Status)) { + return Status; + } + return LookupUnicodeString2 ( Language, This->SupportedLanguages, diff --git a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DriverBinding.c b/Pl= atform/RaspberryPi/Drivers/DwUsbHostDxe/DriverBinding.c index 7f78179d4c06..bada13a6cd7c 100644 --- a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DriverBinding.c +++ b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DriverBinding.c @@ -36,7 +36,7 @@ DriverStop ( IN EFI_HANDLE *ChildHandleBuffer ); =20 -STATIC EFI_DRIVER_BINDING_PROTOCOL mDriverBinding =3D { +EFI_DRIVER_BINDING_PROTOCOL mDriverBinding =3D { DriverSupported, DriverStart, DriverStop, --=20 2.17.1 -=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 (#64300): https://edk2.groups.io/g/devel/message/64300 Mute This Topic: https://groups.io/mt/76213600/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-