From e3df050e5127e9857f90f9322c7f2d0458518955 Mon Sep 17 00:00:00 2001 From: Star Zeng Date: Tue, 13 Mar 2018 15:41:41 +0800 Subject: [PATCH] SecurityPkg OpalPasswordPei: Go next when AhciModeInitialize is failed Go to next loop instead of going to unlock OPAL password when AhciModeInitialize is failed. It is just error handling. Cc: Jiewen Yao Cc: Eric Dong Cc: Chao Zhang Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng Reviewed-by: Jiewen Yao --- .../Tcg/Opal/OpalPassword/OpalPasswordPei.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordPei.c b/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordPei.c index 7f9e14fa81..b4b2d4b3f0 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordPei.c +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordPei.c @@ -717,17 +717,16 @@ UnlockOpalPasswordAta ( ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a() AhciModeInitialize() error, Status: %r\n", __FUNCTION__, Status)); + } else { + OpalDev.Signature = OPAL_PEI_DEVICE_SIGNATURE; + OpalDev.Sscp.ReceiveData = SecurityReceiveData; + OpalDev.Sscp.SendData = SecuritySendData; + OpalDev.DeviceType = OPAL_DEVICE_TYPE_ATA; + OpalDev.Device = (OPAL_DEVICE_COMMON *) DevInfoAta; + OpalDev.Context = &AhciContext; + + UnlockOpalPassword (&OpalDev); } - - OpalDev.Signature = OPAL_PEI_DEVICE_SIGNATURE; - OpalDev.Sscp.ReceiveData = SecurityReceiveData; - OpalDev.Sscp.SendData = SecuritySendData; - OpalDev.DeviceType = OPAL_DEVICE_TYPE_ATA; - OpalDev.Device = (OPAL_DEVICE_COMMON *) DevInfoAta; - OpalDev.Context = &AhciContext; - - UnlockOpalPassword (&OpalDev); - AhciFreeResource (&AhciContext); PciWrite32 (PCI_LIB_ADDRESS (Bus, Device, Function, 0x24), AhciBar); }