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:[email protected]] 
Sent: Tuesday, October 08, 2013 3:40 AM
To: [email protected]
Cc: [email protected]
Subject: [edk2] [PATCH 01/10] MdeModulePkg/MnpDxe: Checked returned value of 
Snp->GetStatus()

From: Olivier Martin <[email protected]>

... as explicitly said by the comment.

Signed-off-by: Olivier Martin <[email protected]>

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) {
-- 
1.7.10.4


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to