[edk2] [PATCH 2/2] MdeModulePkg/UfsPciHc: Avoid overriding return value in BindingStart

Hao Wu posted 2 patches 7 years, 6 months ago
There is a newer version of this series
[edk2] [PATCH 2/2] MdeModulePkg/UfsPciHc: Avoid overriding return value in BindingStart
Posted by Hao Wu 7 years, 6 months ago
In function UfsHcDriverBindingStart(), the return value 'Status' may be
overriden during the original PCI attributes restore process.

This commit refines the logics to avoid such override.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
index 373e55b4c2..241d9bac9f 100644
--- a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
+++ b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
@@ -671,13 +671,12 @@ Done:
       //
       // Restore original PCI attributes
       //
-      Status = PciIo->Attributes (
-                        PciIo,
-                        EfiPciIoAttributeOperationSet,
-                        Private->PciAttributes,
-                        NULL
-                        );
-      ASSERT_EFI_ERROR (Status);
+      ASSERT_EFI_ERROR (PciIo->Attributes (
+                                 PciIo,
+                                 EfiPciIoAttributeOperationSet,
+                                 Private->PciAttributes,
+                                 NULL
+                                 ));
     }
     gBS->CloseProtocol (
           Controller,
-- 
2.12.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 2/2] MdeModulePkg/UfsPciHc: Avoid overriding return value in BindingStart
Posted by Zeng, Star 7 years, 6 months ago
Hao,

ASSERT_EFI_ERROR will be null macro in release mode, but the code still needs to be run in release mode.
I recommend to just remove the Status assignment and ASSERT_EFI_ERROR in the original PCI attributes restore code.

Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Hao Wu
Sent: Monday, April 24, 2017 1:46 PM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A <hao.a.wu@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: [edk2] [PATCH 2/2] MdeModulePkg/UfsPciHc: Avoid overriding return value in BindingStart

In function UfsHcDriverBindingStart(), the return value 'Status' may be overriden during the original PCI attributes restore process.

This commit refines the logics to avoid such override.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
index 373e55b4c2..241d9bac9f 100644
--- a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
+++ b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
@@ -671,13 +671,12 @@ Done:
       //
       // Restore original PCI attributes
       //
-      Status = PciIo->Attributes (
-                        PciIo,
-                        EfiPciIoAttributeOperationSet,
-                        Private->PciAttributes,
-                        NULL
-                        );
-      ASSERT_EFI_ERROR (Status);
+      ASSERT_EFI_ERROR (PciIo->Attributes (
+                                 PciIo,
+                                 EfiPciIoAttributeOperationSet,
+                                 Private->PciAttributes,
+                                 NULL
+                                 ));
     }
     gBS->CloseProtocol (
           Controller,
--
2.12.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel