public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/UefiBootManagerLib: Remove redundant type cast
@ 2017-01-06  8:53 Hao Wu
  2017-01-06  8:54 ` Ni, Ruiyu
  2017-01-06  9:04 ` Wang, Sunny (HPS SW)
  0 siblings, 2 replies; 3+ messages in thread
From: Hao Wu @ 2017-01-06  8:53 UTC (permalink / raw)
  To: edk2-devel; +Cc: Hao Wu, Ruiyu Ni

The type of return value for function EfiBootManagerFindLoadOption() is
INTN. When checking its return value, it is unnecessary to type cast -1 to
type UINTN.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 6b84b85..75bd5dc 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -1,7 +1,7 @@
 /** @file
   Library functions which relates with booting.
 
-Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
 (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -2152,7 +2152,7 @@ EfiBootManagerRefreshAllBootOption (
       // Only check those added by BDS
       // so that the boot options added by end-user or OS installer won't be deleted
       //
-      if (EfiBootManagerFindLoadOption (&NvBootOptions[Index], BootOptions, BootOptionCount) == (UINTN) -1) {
+      if (EfiBootManagerFindLoadOption (&NvBootOptions[Index], BootOptions, BootOptionCount) == -1) {
         Status = EfiBootManagerDeleteLoadOptionVariable (NvBootOptions[Index].OptionNumber, LoadOptionTypeBoot);
         //
         // Deleting variable with current variable implementation shouldn't fail.
@@ -2166,7 +2166,7 @@ EfiBootManagerRefreshAllBootOption (
   // Add new EFI boot options to NV
   //
   for (Index = 0; Index < BootOptionCount; Index++) {
-    if (EfiBootManagerFindLoadOption (&BootOptions[Index], NvBootOptions, NvBootOptionCount) == (UINTN) -1) {
+    if (EfiBootManagerFindLoadOption (&BootOptions[Index], NvBootOptions, NvBootOptionCount) == -1) {
       EfiBootManagerAddLoadOptionVariable (&BootOptions[Index], (UINTN) -1);
       //
       // Try best to add the boot options so continue upon failure.
-- 
1.9.5.msysgit.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] MdeModulePkg/UefiBootManagerLib: Remove redundant type cast
  2017-01-06  8:53 [PATCH] MdeModulePkg/UefiBootManagerLib: Remove redundant type cast Hao Wu
@ 2017-01-06  8:54 ` Ni, Ruiyu
  2017-01-06  9:04 ` Wang, Sunny (HPS SW)
  1 sibling, 0 replies; 3+ messages in thread
From: Ni, Ruiyu @ 2017-01-06  8:54 UTC (permalink / raw)
  To: Wu, Hao A, edk2-devel@lists.01.org

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Regards,
Ray

>-----Original Message-----
>From: Wu, Hao A
>Sent: Friday, January 6, 2017 4:53 PM
>To: edk2-devel@lists.01.org
>Cc: Wu, Hao A <hao.a.wu@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>
>Subject: [PATCH] MdeModulePkg/UefiBootManagerLib: Remove redundant type cast
>
>The type of return value for function EfiBootManagerFindLoadOption() is
>INTN. When checking its return value, it is unnecessary to type cast -1 to
>type UINTN.
>
>Cc: Ruiyu Ni <ruiyu.ni@intel.com>
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Hao Wu <hao.a.wu@intel.com>
>---
> MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
>b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
>index 6b84b85..75bd5dc 100644
>--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
>+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
>@@ -1,7 +1,7 @@
> /** @file
>   Library functions which relates with booting.
>
>-Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
>+Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
> (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD License
>@@ -2152,7 +2152,7 @@ EfiBootManagerRefreshAllBootOption (
>       // Only check those added by BDS
>       // so that the boot options added by end-user or OS installer won't be deleted
>       //
>-      if (EfiBootManagerFindLoadOption (&NvBootOptions[Index], BootOptions, BootOptionCount) == (UINTN) -1) {
>+      if (EfiBootManagerFindLoadOption (&NvBootOptions[Index], BootOptions, BootOptionCount) == -1) {
>         Status = EfiBootManagerDeleteLoadOptionVariable (NvBootOptions[Index].OptionNumber, LoadOptionTypeBoot);
>         //
>         // Deleting variable with current variable implementation shouldn't fail.
>@@ -2166,7 +2166,7 @@ EfiBootManagerRefreshAllBootOption (
>   // Add new EFI boot options to NV
>   //
>   for (Index = 0; Index < BootOptionCount; Index++) {
>-    if (EfiBootManagerFindLoadOption (&BootOptions[Index], NvBootOptions, NvBootOptionCount) == (UINTN) -1) {
>+    if (EfiBootManagerFindLoadOption (&BootOptions[Index], NvBootOptions, NvBootOptionCount) == -1) {
>       EfiBootManagerAddLoadOptionVariable (&BootOptions[Index], (UINTN) -1);
>       //
>       // Try best to add the boot options so continue upon failure.
>--
>1.9.5.msysgit.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] MdeModulePkg/UefiBootManagerLib: Remove redundant type cast
  2017-01-06  8:53 [PATCH] MdeModulePkg/UefiBootManagerLib: Remove redundant type cast Hao Wu
  2017-01-06  8:54 ` Ni, Ruiyu
@ 2017-01-06  9:04 ` Wang, Sunny (HPS SW)
  1 sibling, 0 replies; 3+ messages in thread
From: Wang, Sunny (HPS SW) @ 2017-01-06  9:04 UTC (permalink / raw)
  To: Hao Wu, edk2-devel@lists.01.org; +Cc: Ruiyu Ni, Wang, Sunny (HPS SW)

Looks good to me. 
Reviewed-by: Sunny Wang <sunnywang@hpe.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Hao Wu
Sent: Friday, January 06, 2017 4:53 PM
To: edk2-devel@lists.01.org
Cc: Hao Wu <hao.a.wu@intel.com>; Ruiyu Ni <ruiyu.ni@intel.com>
Subject: [edk2] [PATCH] MdeModulePkg/UefiBootManagerLib: Remove redundant type cast

The type of return value for function EfiBootManagerFindLoadOption() is INTN. When checking its return value, it is unnecessary to type cast -1 to type UINTN.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 6b84b85..75bd5dc 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -1,7 +1,7 @@
 /** @file
   Library functions which relates with booting.
 
-Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
 (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>  This program and the accompanying materials  are licensed and made available under the terms and conditions of the BSD License @@ -2152,7 +2152,7 @@ EfiBootManagerRefreshAllBootOption (
       // Only check those added by BDS
       // so that the boot options added by end-user or OS installer won't be deleted
       //
-      if (EfiBootManagerFindLoadOption (&NvBootOptions[Index], BootOptions, BootOptionCount) == (UINTN) -1) {
+      if (EfiBootManagerFindLoadOption (&NvBootOptions[Index], 
+ BootOptions, BootOptionCount) == -1) {
         Status = EfiBootManagerDeleteLoadOptionVariable (NvBootOptions[Index].OptionNumber, LoadOptionTypeBoot);
         //
         // Deleting variable with current variable implementation shouldn't fail.
@@ -2166,7 +2166,7 @@ EfiBootManagerRefreshAllBootOption (
   // Add new EFI boot options to NV
   //
   for (Index = 0; Index < BootOptionCount; Index++) {
-    if (EfiBootManagerFindLoadOption (&BootOptions[Index], NvBootOptions, NvBootOptionCount) == (UINTN) -1) {
+    if (EfiBootManagerFindLoadOption (&BootOptions[Index], 
+ NvBootOptions, NvBootOptionCount) == -1) {
       EfiBootManagerAddLoadOptionVariable (&BootOptions[Index], (UINTN) -1);
       //
       // Try best to add the boot options so continue upon failure.
--
1.9.5.msysgit.0

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-06  9:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-06  8:53 [PATCH] MdeModulePkg/UefiBootManagerLib: Remove redundant type cast Hao Wu
2017-01-06  8:54 ` Ni, Ruiyu
2017-01-06  9:04 ` Wang, Sunny (HPS SW)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox