From: Kazuhiko Sakamoto <sakamoto.kazuhiko@socionext.com>
Test the @ControllerHandle is not NULL and is actually managed by
this driver.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Kazuhiko Sakamoto <sakamoto.kazuhiko@socionext.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
---
Silicon/Atmel/AtSha204a/AtSha204aDriver.h | 1 +
Silicon/Atmel/AtSha204a/ComponentName.c | 13 +++++++++++++
Silicon/Atmel/AtSha204a/DriverBinding.c | 1 -
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/Silicon/Atmel/AtSha204a/AtSha204aDriver.h b/Silicon/Atmel/AtSha204a/AtSha204aDriver.h
index 615959baf4..11be15b25b 100644
--- a/Silicon/Atmel/AtSha204a/AtSha204aDriver.h
+++ b/Silicon/Atmel/AtSha204a/AtSha204aDriver.h
@@ -59,6 +59,7 @@ typedef struct {
#define ATSHA204A_OPCODE_RANDOM 0x1b
extern EFI_COMPONENT_NAME2_PROTOCOL gAtSha204aDriverComponentName2;
+extern EFI_DRIVER_BINDING_PROTOCOL gI2cHwrngDriverBinding;
EFI_STATUS
AtSha204aInit (
diff --git a/Silicon/Atmel/AtSha204a/ComponentName.c b/Silicon/Atmel/AtSha204a/ComponentName.c
index eec7b9120b..cc1d970bcf 100644
--- a/Silicon/Atmel/AtSha204a/ComponentName.c
+++ b/Silicon/Atmel/AtSha204a/ComponentName.c
@@ -159,6 +159,19 @@ AtSha204aGetControllerName (
OUT CHAR16 **ControllerName
)
{
+ EFI_STATUS Status;
+
+ if (!ControllerHandle) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = EfiTestManagedDevice (ControllerHandle,
+ gI2cHwrngDriverBinding.DriverBindingHandle,
+ &gEfiI2cIoProtocolGuid);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
if (ChildHandle != NULL) {
return EFI_UNSUPPORTED;
}
diff --git a/Silicon/Atmel/AtSha204a/DriverBinding.c b/Silicon/Atmel/AtSha204a/DriverBinding.c
index 38ffd80df9..e278ab0554 100644
--- a/Silicon/Atmel/AtSha204a/DriverBinding.c
+++ b/Silicon/Atmel/AtSha204a/DriverBinding.c
@@ -132,7 +132,6 @@ I2cHwrngDriverBindingStop (
}
-STATIC
EFI_DRIVER_BINDING_PROTOCOL gI2cHwrngDriverBinding = {
I2cHwrngDriverBindingSupported,
I2cHwrngDriverBindingStart,
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81860): https://edk2.groups.io/g/devel/message/81860
Mute This Topic: https://groups.io/mt/86281583/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-