From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1E0A82274F3D1 for ; Thu, 12 Apr 2018 21:13:56 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2018 21:13:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,444,1517904000"; d="scan'208";a="31709847" Received: from rni2-mobl2.ccr.corp.intel.com ([10.255.28.108]) by fmsmga007.fm.intel.com with ESMTP; 12 Apr 2018 21:13:55 -0700 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Steven Shi , Star Zeng Date: Fri, 13 Apr 2018 12:13:52 +0800 Message-Id: <20180413041352.27740-1-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 Subject: [PATCH] MdeModulePkg/Terminal: Check status of OpenProtocol in BindingStart X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Apr 2018 04:13:57 -0000 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Steven Shi Cc: Star Zeng --- MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c index 60de2d4d6d..66dd3ad550 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c @@ -2,7 +2,7 @@ Produces Simple Text Input Protocol, Simple Text Input Extended Protocol and Simple Text Output Protocol upon Serial IO Protocol. -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -488,6 +488,9 @@ TerminalDriverBindingStart ( EFI_OPEN_PROTOCOL_BY_DRIVER ); ASSERT ((Status == EFI_SUCCESS) || (Status == EFI_ALREADY_STARTED)); + if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) { + return Status; + } // // Open the Serial I/O Protocol BY_DRIVER. It might already be started. @@ -501,6 +504,9 @@ TerminalDriverBindingStart ( EFI_OPEN_PROTOCOL_BY_DRIVER ); ASSERT ((Status == EFI_SUCCESS) || (Status == EFI_ALREADY_STARTED)); + if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) { + return Status; + } if (!IsHotPlugDevice (ParentDevicePath)) { // -- 2.14.1.windows.1