From patchwork Tue Oct 8 08:51:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Siyuan" X-Patchwork-Id: 20888 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f200.google.com (mail-qc0-f200.google.com [209.85.216.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A3D3A24697 for ; Tue, 8 Oct 2013 08:51:54 +0000 (UTC) Received: by mail-qc0-f200.google.com with SMTP id x20sf15960337qcv.7 for ; Tue, 08 Oct 2013 01:51:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:thread-topic :thread-index:date:message-id:accept-language:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe:content-language:content-type :content-transfer-encoding; bh=SojCRDZm3oIWzKj9Vcxyo7LMcONak8gzhF26HlG3RXs=; b=jcFuAAWr2r2XIcKS5T3zDYzEVskY+HU4YcV4U5zmMplKB2F4ZVsnn2aQj4E0CxXeod qUDOlChCRyhno/xZEvuPN34Eoqx7eYaHYsfevkfnYazohZ+6BkP2EOjV5f/gay7FbO4N krRFEgv+35cQZoEAQaQfRwboM3FLpkvpJzxAPFLmlTVXPDrmuqjt6uQ6SMpQrrbb88RD U+E2oBJb66EgqHi/b/PcfPi7YpKJ0BAdqX48fw+eBPsC006QJseFtvJSf5nZM+PUlvnB FsOcyoa1ygGYgMDOzAUl8Bx1d/nD04xKg1MnsoR2gkjROEcVAwAdKtf4WZngMp4fv3D1 UOuw== X-Received: by 10.236.34.134 with SMTP id s6mr344168yha.49.1381222314060; Tue, 08 Oct 2013 01:51:54 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.85.200 with SMTP id j8ls133472qez.6.gmail; Tue, 08 Oct 2013 01:51:53 -0700 (PDT) X-Received: by 10.220.16.73 with SMTP id n9mr194132vca.24.1381222313971; Tue, 08 Oct 2013 01:51:53 -0700 (PDT) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx.google.com with ESMTPS id wh9si9107899vcb.18.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Oct 2013 01:51:53 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.54 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.54; Received: by mail-vb0-f54.google.com with SMTP id q14so4136731vbe.13 for ; Tue, 08 Oct 2013 01:51:53 -0700 (PDT) X-Gm-Message-State: ALoCoQmFdbyp+JAI1WttzV1Yv+vFpKVaa8mADoZWmLu8bGNchQ1uiTY7kArYl/DO/07o3uV8MYrb X-Received: by 10.221.53.74 with SMTP id vp10mr187076vcb.54.1381222313752; Tue, 08 Oct 2013 01:51:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp187962vcz; Tue, 8 Oct 2013 01:51:53 -0700 (PDT) X-Received: by 10.66.136.71 with SMTP id py7mr2327839pab.2.1381222312289; Tue, 08 Oct 2013 01:51:52 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com. [134.134.136.20]) by mx.google.com with ESMTP id gv2si24954446pbb.161.1969.12.31.16.00.00; Tue, 08 Oct 2013 01:51:52 -0700 (PDT) Received-SPF: pass (google.com: domain of siyuan.fu@intel.com designates 134.134.136.20 as permitted sender) client-ip=134.134.136.20; Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 08 Oct 2013 01:51:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.90,1056,1371106800"; d="scan'208";a="389472122" Received: from fmsmsx103.amr.corp.intel.com ([10.19.9.34]) by orsmga001.jf.intel.com with ESMTP; 08 Oct 2013 01:51:50 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX103.amr.corp.intel.com (10.19.9.34) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 8 Oct 2013 01:51:46 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.117]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.68]) with mapi id 14.03.0123.003; Tue, 8 Oct 2013 16:51:43 +0800 From: "Fu, Siyuan" To: "Reece R. Pollack" CC: "patches@linaro.org" , "edk2-devel@lists.sourceforge.net" Subject: RE: [edk2] [PATCH 01/10] MdeModulePkg/MnpDxe: Checked returned value of Snp->GetStatus() Thread-Topic: [edk2] [PATCH 01/10] MdeModulePkg/MnpDxe: Checked returned value of Snp->GetStatus() Thread-Index: Ac7EA5x5J+MfsvINTAm9FYiNPF7abQ== Date: Tue, 8 Oct 2013 08:51:43 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: siyuan.fu@intel.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.54 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Content-Language: en-US Hi, Pollack and Martin Here calling Snp->GetStatus() without state code check is intend to update the MediaPresent field of EFI_SIMPLE_NETWORK_MODE to reflect the latest media status. Even though this call meet some errors we still need to return SnpModeData to the caller since SnpModeData contains many other fields other than MediaPresent. So I think move CopyMem into the conditional statements is not a good idea. Siyuan Best regards -----Original Message----- From: Reece R. Pollack [mailto:reece.pollack@linaro.org] Sent: Tuesday, October 08, 2013 3:40 AM To: edk2-devel@lists.sourceforge.net Cc: patches@linaro.org Subject: [edk2] [PATCH 01/10] MdeModulePkg/MnpDxe: Checked returned value of Snp->GetStatus() From: Olivier Martin ... as explicitly said by the comment. Signed-off-by: Olivier Martin Change-Id: Id9fd51dd5510d6acd04fe2c323a901248c4b85c3 --- MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c index 4c0f3dd..9cdbb43 100644 --- a/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c +++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c @@ -79,8 +79,10 @@ MnpGetModeData ( // Upon successful return of GetStatus(), the Snp->Mode->MediaPresent // will be updated to reflect any change of media status // - Snp->GetStatus (Snp, &InterruptStatus, NULL); - CopyMem (SnpModeData, Snp->Mode, sizeof (*SnpModeData)); + Status = Snp->GetStatus (Snp, &InterruptStatus, NULL); + if (!EFI_ERROR (Status)) { + CopyMem (SnpModeData, Snp->Mode, sizeof (*SnpModeData)); + } } if (!Instance->Configured) {