[edk2-devel] [Patch 01/16] Vlv2TbltDevicePkg/PlatformFlashAccessLib: Add error return

Michael D Kinney posted 16 patches 6 years, 9 months ago
[edk2-devel] [Patch 01/16] Vlv2TbltDevicePkg/PlatformFlashAccessLib: Add error return
Posted by Michael D Kinney 6 years, 9 months ago
If the FLASH device cannot be erased or written, then the
flag FlashError is set to TRUE.

Add the missing logic to return an error if FlashError
is TRUE.  The missing logic was found from a GCC build that
noticed a local variable was declared and assigned, but was
not being used.

Cc: Zailiang Sun <zailiang.sun@intel.com>
Cc: Yi Qian <yi.qian@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 .../Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
index 052ccb891c..079c3ef2d6 100644
--- a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
+++ b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
@@ -1,7 +1,7 @@
 /** @file
   Platform Flash Access library.
 
-  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -529,6 +529,10 @@ Done:
     Progress (EndPercentage);
   }
 
+  if (FlashError) {
+    return EFI_WRITE_PROTECTED;
+  }
+
   return EFI_SUCCESS;
 }
 
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#40247): https://edk2.groups.io/g/devel/message/40247
Mute This Topic: https://groups.io/mt/31551769/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [Patch 01/16] Vlv2TbltDevicePkg/PlatformFlashAccessLib: Add error return
Posted by Sun, Zailiang 6 years, 9 months ago
Reviewed-by: Zailiang Sun <zailiang.sun@intel.com>

> -----Original Message-----
> From: Kinney, Michael D
> Sent: Thursday, May 9, 2019 12:31 PM
> To: devel@edk2.groups.io
> Cc: Sun, Zailiang <zailiang.sun@intel.com>; Qian, Yi <yi.qian@intel.com>
> Subject: [Patch 01/16] Vlv2TbltDevicePkg/PlatformFlashAccessLib: Add error
> return
> 
> If the FLASH device cannot be erased or written, then the flag FlashError is
> set to TRUE.
> 
> Add the missing logic to return an error if FlashError is TRUE.  The missing logic
> was found from a GCC build that noticed a local variable was declared and
> assigned, but was not being used.
> 
> Cc: Zailiang Sun <zailiang.sun@intel.com>
> Cc: Yi Qian <yi.qian@intel.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  .../Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git
> a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/Platfo
> rmFlashAccessLib.c
> b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/Platf
> ormFlashAccessLib.c
> index 052ccb891c..079c3ef2d6 100644
> ---
> a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/Platfo
> rmFlashAccessLib.c
> +++ b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/P
> +++ latformFlashAccessLib.c
> @@ -1,7 +1,7 @@
>  /** @file
>    Platform Flash Access library.
> 
> -  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2016 - 2019, Intel Corporation. All rights
> + reserved.<BR>
>    SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -529,6 +529,10 @@ Done:
>      Progress (EndPercentage);
>    }
> 
> +  if (FlashError) {
> +    return EFI_WRITE_PROTECTED;
> +  }
> +
>    return EFI_SUCCESS;
>  }
> 
> --
> 2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#40288): https://edk2.groups.io/g/devel/message/40288
Mute This Topic: https://groups.io/mt/31551769/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [Patch 01/16] Vlv2TbltDevicePkg/PlatformFlashAccessLib: Add error return
Posted by Qian, Yi 6 years, 9 months ago
Reviewed by Qian, Yi <yi.qian@intel.com>

Thanks
QianYi

-----Original Message-----
From: Kinney, Michael D 
Sent: Thursday, May 9, 2019 12:31 PM
To: devel@edk2.groups.io
Cc: Sun, Zailiang <zailiang.sun@intel.com>; Qian, Yi <yi.qian@intel.com>
Subject: [Patch 01/16] Vlv2TbltDevicePkg/PlatformFlashAccessLib: Add error return

If the FLASH device cannot be erased or written, then the flag FlashError is set to TRUE.

Add the missing logic to return an error if FlashError is TRUE.  The missing logic was found from a GCC build that noticed a local variable was declared and assigned, but was not being used.

Cc: Zailiang Sun <zailiang.sun@intel.com>
Cc: Yi Qian <yi.qian@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 .../Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
index 052ccb891c..079c3ef2d6 100644
--- a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
+++ b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/P
+++ latformFlashAccessLib.c
@@ -1,7 +1,7 @@
 /** @file
   Platform Flash Access library.
 
-  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2016 - 2019, Intel Corporation. All rights 
+ reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -529,6 +529,10 @@ Done:
     Progress (EndPercentage);
   }
 
+  if (FlashError) {
+    return EFI_WRITE_PROTECTED;
+  }
+
   return EFI_SUCCESS;
 }
 
--
2.21.0.windows.1



-- 
Qian Yi

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#40337): https://edk2.groups.io/g/devel/message/40337
Mute This Topic: https://groups.io/mt/31551769/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [Patch 01/16] Vlv2TbltDevicePkg/PlatformFlashAccessLib: Add error return
Posted by Sun, Zailiang 6 years, 9 months ago
Reviewed-by: Zailiang Sun <zailiang.sun@intel.com>

> -----Original Message-----
> From: Kinney, Michael D
> Sent: Thursday, May 9, 2019 12:31 PM
> To: devel@edk2.groups.io
> Cc: Sun, Zailiang <zailiang.sun@intel.com>; Qian, Yi <yi.qian@intel.com>
> Subject: [Patch 01/16] Vlv2TbltDevicePkg/PlatformFlashAccessLib: Add error
> return
> 
> If the FLASH device cannot be erased or written, then the flag FlashError is
> set to TRUE.
> 
> Add the missing logic to return an error if FlashError is TRUE.  The missing logic
> was found from a GCC build that noticed a local variable was declared and
> assigned, but was not being used.
> 
> Cc: Zailiang Sun <zailiang.sun@intel.com>
> Cc: Yi Qian <yi.qian@intel.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  .../Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git
> a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/Platfo
> rmFlashAccessLib.c
> b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/Platf
> ormFlashAccessLib.c
> index 052ccb891c..079c3ef2d6 100644
> ---
> a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/Platfo
> rmFlashAccessLib.c
> +++ b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/P
> +++ latformFlashAccessLib.c
> @@ -1,7 +1,7 @@
>  /** @file
>    Platform Flash Access library.
> 
> -  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2016 - 2019, Intel Corporation. All rights
> + reserved.<BR>
>    SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -529,6 +529,10 @@ Done:
>      Progress (EndPercentage);
>    }
> 
> +  if (FlashError) {
> +    return EFI_WRITE_PROTECTED;
> +  }
> +
>    return EFI_SUCCESS;
>  }
> 
> --
> 2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#40287): https://edk2.groups.io/g/devel/message/40287
Mute This Topic: https://groups.io/mt/31551769/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-